We are having trouble reading a csv file. I have attached a small sample file that shows the issue. Please run the following code to see the issue:
- Code: Select all
try
{
string FilePath = @"20200213_xxxxxxxxxxxNotes.csv";
IWorkbook Workbook = Factory.GetWorkbook(FilePath);
IWorksheet Worksheet = Workbook.ActiveWorksheet;
for (int r = 0; r < 3; r++)
{
for (int c = 0; c < 8; c++)
{
object obj = Worksheet.Cells[r, c].Value;
string Value = (obj != null) ? obj.ToString() : "[null]";
System.Diagnostics.Debug.WriteLine($"Row {r} Col {c}: {Value}");
}
}
}
catch (Exception Ex)
{
System.Diagnostics.Debug.WriteLine(Ex.Message);
}
The output of the above code is the following:
- Code: Select all
Row 0 Col 0: loan_number
Row 0 Col 1: investor_id
Row 0 Col 2: investor_group
Row 0 Col 3: trust_name
Row 0 Col 4: source
Row 0 Col 5: comment_date
Row 0 Col 6: comment_added_by_id
Row 0 Col 7: note
Row 1 Col 0: 1111111111
Row 1 Col 1: 555
Row 1 Col 2: AAA
Row 1 Col 3: RMTP 2019-C2
Row 1 Col 4: COL
Row 1 Col 5: 02/12/2020
Row 1 Col 6: ANI
Row 1 Col 7: 9999999999
Row 2 Col 0: 2222222222
Row 2 Col 1: 555
Row 2 Col 2: BBB
Row 2 Col 3: RMTP 2019-C2
Row 2 Col 4: FOR
Row 2 Col 5: 02/12/2020
Row 2 Col 6: (WS
Row 2 Col 7: [null]
The very last cell contains a string, but the value being returned is null. Are you able to reproduce this problem? Any idea what is causing it?
Thanks.
Tom Ward