How do I reference a field by it's (first) column name when not using a DataTable?
while (excelReader.Read())
{
var branch = excelReader["Branch"].ToString(); // <-- I get a __NotSupportedException__
Also, it seems the "IsFirstRowAsColumnNames" property is ignored if you're enumerating the reader? I checked a value by index and it was the header row.
Comments: ** Comment from web user: jonkey86 **
while (excelReader.Read())
{
var branch = excelReader["Branch"].ToString(); // <-- I get a __NotSupportedException__
Also, it seems the "IsFirstRowAsColumnNames" property is ignored if you're enumerating the reader? I checked a value by index and it was the header row.
Comments: ** Comment from web user: jonkey86 **
I have a similar issue in which if my column header has a trailing space, the ExcelDataReader will not be able to parse the column
I can usually do this, row["ColumnName"] but if when it has a trailing space, I can't event do this row["ColumnName "] as I get the same exception.
My only choice is to either remove the trailing space from the spreadsheet, or reference the column by index.
Anyone experience something similar?