We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

In CSV File If All Fields Has Double Quots- Worksheet gives wrong information

Hi,

I am using aspose.cells v4.8.1.0, I used following code to open a CSV file.

mDocument = New Workbook()
mDocument.Open(strFileName, FileFormatType.CSV)
If (mDocument.Worksheets.Count > 0) Then
worksheet = mDocument.Worksheets(0)
End If

When I say worksheet.cells(1,1) i am getting value “Tisdale” (from attached file Original.csv); This is Row#6 in CSV file it appears that rows before this row are ignored. (as if they are not exists); At the same time Cells.MaxRow and Cells.MaxDataRow gives me correct count of rows but worksheet.cells(4,1) results in nothing (null in C#)

To resolve this i took following actions

1. I opened file in Excel and saved as CSV; The only difference is excel have removed double quotes from all fields. except those which has comma as values. I started getting correct result after this.

2. I added some value in last column of record#6 (where earlier it was empty earlier) value was "xxxxx@abc.com" (with double quots) and it started to give me correct result.

This file gets generated automatically and we can not change this process, Kindly advice course of action to resolve this issue.

I have attached 2 sample files

1. Original.csv this is original format which we tried to process.
2. Excel.csv this is result after opening and saving same file in excel.

Hi,

I have tested using your file with the code (given below) using Aspose.Cells for .NET v4.9.0.2 (attached) and it works fine.

Sample code:
Workbook workbook = new Workbook();
workbook.Open(@“e:\test\incsv\Original.csv”, FileFormatType.CSV);
MessageBox.Show(workbook.Worksheets[0].Cells[“B2”].StringValue);//It gives Cavener - OK


Please try the attached version and let us know if you still find the issue.

Thank you.