Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best / fastest way to export large set of data from C# to excel

I have code that uses the OpenXML library to export data.

I have 20,000 rows and 22 columns and it takes ages (about 10 minutes).

is there any solution that would export data from C# to excel that would be faster as i am doing this from an asp.net mvc app and many people browsers are timing out.

like image 336
leora Avatar asked Oct 09 '22 17:10

leora


1 Answers

Assuming 20'000 rows and 22 columns with about 100 bytes each, makes 41 megabytes data alone. plus xml tags, plus formatting, I'd say you end up zipping (.xlsx is nothing but several zipped xml files) 100 mb of data.

Of course this takes a while, and so does fetching the data. I recommend you use excel package plus instead of the Office OpenXML development kit. http://epplus.codeplex.com/

There's probably a bug/performance-issue in the write-in-a-hurry-and-hope-that-it-doesnt-blow-up-too-soon Microsoft code.

like image 193
Stefan Steiger Avatar answered Oct 13 '22 10:10

Stefan Steiger