This project has moved and is read-only. For the latest updates, please go here.

Writing 4 Million cells quickly (not cell by cell, but e.g. by column or by range)

Feb 23, 2016 at 12:55 PM
I am rather new to EPPlus, but so far it worked great for me.

I have measured about 4 Million data poins in an array in Visual C#.

Now I need to write the into an Excel Spreadsheet. Doing this "Cell by Cell" works, but becomes very slow (many hours simply for writing the file in the end). In particular this line takes forever:
Is there a possibility to write a full range of cells, by creating a (2D) array of objects in C# and writing the full array to the Worksheet with EPPlus? This would be great! I found this way of speeding up the writing process within

using Microsoft.Office.Interop.Excel;

Here the syntax is (where formattedSpectralData is the 2D array of doubles in this case):
        var startCell = (Range)spectraWorksheet.Cells[startSpecRow, startSpecCol];
        var endCell = (Range)spectraWorksheet.Cells[nSpectra, nWavelengthVals];
        var writeRange = spectraWorksheet.Range[startCell, endCell];

        writeRange.Value2 = formattedSpectralData;
Is there anything like this in EPPlus? I'd really love to continue using EPPlus, but at the moment this is just by far too slow.

Thanks a lot in advance!
Mar 11, 2016 at 11:15 AM
In ver. 4.0.5, EPPlus supports load data from Array, DataSet, DataReader, or Text.
But they are very slow (because simply loops range cell, in implementation).

I need to work with huge excel data, too,
so I've tried to improve implementation out of necessity,
and created patch set & pull request.
It supports 2D array set to Value (like your sample).

You can take it if you like: