Hi all, I am using the CSVParser class located on this thead This seems to work just fine with smaller files, I however have a file that is around 117Mb which contains 764,298 rows of data and the CSVParser seems to fail, I do not get any errors but my NON_UI file stops working after a while.
Here's the relevant code where I parse the csv file and I try to convert it to an xls workbook because when I try to read the file directly from the csv file it fails and throws an error.
Again, if I run this code with a 35Mb file with 70 rows of data then it works just fine, it's just with bigger files that I am seeing the issue where the app just stops working without any errors.
I added some logs to see where the entire code stops working, the last log I see is when it gets inside the CreateWorkBook sub, I never see the last line which should say "finished creating workbook'
I also added a log inside the second for loop inside the CreateWorkBook sub which logs the number of rows written, I can see that when it gets around 400000 is when it starts getting sluggish, I can see the app starts slowing down and eventually it stops. I was finally able to see a pop up error, please see image attached for the error.
Any ideas anyone?
Thanks,
walter
Here's the relevant code where I parse the csv file and I try to convert it to an xls workbook because when I try to read the file directly from the csv file it fails and throws an error.
CSVParser:
Sub parseFile
Dim parser As CSVParser
Dim homepath As String = GetSystemProperty("user.home","")
homepath = homepath & "\Documents\Arbin_Data"
Log("homepath: " & homepath)
parser.Initialize
Dim tr As TextReader
tr.Initialize2(File.OpenInput(homepath&"\"&"Resume_Table.csv", ""), "Windows-1252")
Log("reading file into string")
Dim input As String = tr.ReadAll
Log("file read into string")
Dim table As List = parser.Parse(input, ",", False)
Log("file parse into table")
CreateWorkbook(table, "Resume_Table.csv")
End Sub
CreateWorkBook:
Private Sub CreateWorkbook (Table As List, FileName As String)
Log("creating workbook")
xl.Initialize
Dim wb As XLWorkbookWriter = xl.CreateWriterBlank
Dim sheet As XLSheetWriter = wb.CreateSheetWriterByName("Sheet1")
Dim address As XLAddress = xl.AddressName("A1")
For Each row() As String In Table
address.Col0Based = 0
For Each cell As String In row
sheet.PutString(address, cell)
address.Col0Based = address.Col0Based + 1
Next
address.Row0Based = address.Row0Based + 1
Log("row #: " & address.Row0Based)
Next
Log("saving new file to: " & FileName)
wb.SaveAs(FileName, "", False)
Log("finished creating workbook")
End Sub
Again, if I run this code with a 35Mb file with 70 rows of data then it works just fine, it's just with bigger files that I am seeing the issue where the app just stops working without any errors.
I added some logs to see where the entire code stops working, the last log I see is when it gets inside the CreateWorkBook sub, I never see the last line which should say "finished creating workbook'
I also added a log inside the second for loop inside the CreateWorkBook sub which logs the number of rows written, I can see that when it gets around 400000 is when it starts getting sluggish, I can see the app starts slowing down and eventually it stops. I was finally able to see a pop up error, please see image attached for the error.
Any ideas anyone?
Thanks,
walter
Last edited: