EPPlus - Row Out Of Range exception

Viewed 9858

I'm trying to import datatable with 1000000 records into Excel using EPPlus library.

ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Demo");
var recordCount = dt.Rows.Count;
ws.Cells["A5"].LoadFromDataTable(dt, true); 

I'm getting Row Out of Range exception on ws.Cells["A5"].LoadFromDataTable(dt, true); line

It worked when I had 1000 records.

Is there row limit size when working with EPPlus?

3 Answers

When you get "Row out of range", the row parameter is probably too high or too low. Remember that it starts to count from 1.

I got this error when I had placed a list in a list. Should have been only a list and not a list in a list.

To be exact i created a list of object that I then placed in a list, parsed to JSON and loaded to a DataTable with JsonConvert.DeserializeObject(json, jsonFormat). Then I got the error.

Related