-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
We are parsing a spreadsheet that contains 47625 rows including a header row. The header row starts from column A to J. Below is the logic that we are using to load the spreadsheet.
using (var reader = ExcelReaderFactory.CreateReader(stream, new ExcelReaderConfiguration
{
Password ="Pwd"
}))
{
_logger.LogInformation("Read {Count} records from the CSV file", reader.RowCount);
reader.Read();
while (reader.Read())
{
var userRecord = new Record
{
Id = reader.GetString(0),
GUID = reader.GetString(1),
Email = reader.GetString(2),
Salutation = reader.GetString(3),
FirstName = reader.GetString(4),
LastName = reader.GetString(5),
Type = reader.GetString(6),
Reference = reader.GetString(7),
Comp = reader.GetString(8)
LastLogin = reader.GetString(9)
};
userRecords.Add(userRecord);
}
}
RowCount is getting logged as 47620 whereas we have 47624 excluding header row.
Also, the code reader.GetString(9) throws index out of exception though there are 9 columns.
Any idea on what I am doing wrong here ?