0

I'm attempting to import a simple Excel data table into a strongly typed IEnumerable in C#. I'm using FileHelpers ExcelNPOIStorage engine to do this, assuming this won't require Excel to be installed on the user's machine (as the deprecated ExcelStorage option requires).

private T[] UseExcelNPOIStorage(string filename, bool skipFirstRow = true, int startColumn = 1)
{
    ExcelNPOIStorage provider = new ExcelNPOIStorage(typeof(T), filename, skipFirstRow ? 1 : 0, 1);
    provider.Progress += Provider_Progress;
    provider.ExcelReadStopBehavior = ExcelReadStopBehavior.StopOnEmptyRow;
    provider.ExcelReadStopAfterEmptyRows = 2;
    provider.StartRow = skipFirstRow ? 1 : 0;
    try
    {
        return (T[])provider.ExtractRecords();
    }
    catch (Exception ex)
    { }

   return null;
}

When using the method listed above, I receive an "Index was outside the bounds of the array" exception. Am I missing something?

Jonathan Shay
  • 916
  • 8
  • 12
  • Can you copy and paste the full exception you are getting? If you are in Visual Studio, this has the ability to copy exception to clipboard where you'll be able to paste it here. And do you have a sample project that I can look at? – netniV Oct 30 '15 at 10:19
  • Did you get to the bottom of this ? – netniV Nov 02 '15 at 18:29
  • Just saw this. I've since switched projects and am not using this library. Sadly, I've found that it's not very active and rather buggy. It has potential, but it's not for me at the moment. But no, I never got to the bottom of the issue. – Jonathan Shay Jul 23 '16 at 05:07

0 Answers0