Skip to content

Instantly share code, notes, and snippets.

@jahav
Created May 28, 2023 11:57
Show Gist options
  • Save jahav/505d679ebc5b06a1adb1901498ae1b46 to your computer and use it in GitHub Desktop.
Save jahav/505d679ebc5b06a1adb1901498ae1b46 to your computer and use it in GitHub Desktop.
using var wb = new XLWorkbook();
var ws = wb.AddWorksheet();
var data = Enumerable.Range(0, 500000).Select(x => new
{
One = 1,
Two = 2,
Three = 3,
Four = 3.14,
Five = true,
Six = false,
Seven = "Hello",
Eight = Blank.Value
});
var ss = Stopwatch.StartNew();
ws.FirstCell().InsertData(data);
Console.WriteLine("Insert: Elapsed {0} ms", ss.ElapsedMilliseconds);
ss.Restart();
wb.SaveAs(@"c:\Temp\Issues\1969\test.xlsx");
Console.WriteLine("Save: Elapsed {0} ms", ss.ElapsedMilliseconds);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment