I am using EPPlus to export an excel file to a path. However, the export feels like it may be too slow, although I don't exactly have anything to compare it to. For a 7.5mb file (50,000 records and ~60 columns) it takes around 7 seconds for the pck.Save()
line to execute.
How could I make it faster?
I'm not really sure what to try here to improve it, unless there's some faster ways I could go about exporting the file to a path.
public void ExportTableToGivenPath(DataTable DataTable, string Path)
{
FileInfo File = new FileInfo(Path);
//Before continuing make sure file that matched passed in is delete to prevent Exceptions
if (File.Exists)
{
File.Delete();
}
using (ExcelPackage pck = new ExcelPackage(File))
{
ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Test");
ws.Cells["A1"].LoadFromDataTable(DataTable, true);
pck.Save(); //slow process here
}
}