I am trying to import an excel file into a data table using GemBox and I keep getting this error:
Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1.
As far as I can tell my code is correct and my file is file fine. Does anyone have any ideas?
Thanks.
ExcelWorksheet Ew = ExFi.Worksheets[0];
for (int i = 0; i < Ew.Columns.Count; ++i)
{
if (Ew.Rows[0].Cells[0, i].Value != null)
dsTable.Columns.Add(Ew.Rows[0].Cells[0, i].Value.ToString(), typeof(string));
}
try
{
Ew.ExtractToDataTable(dsTable, Ew.Rows.Count, ExtractDataOptions.StopAtFirstEmptyRow, Ew.Rows[1], Ew.Columns[0]);
}