Extension takes forever to export large table as Excel


The extension takes forever to Export a large table to Excel. SQL Server transfers the data to the client within a few seconds, but the app sits processing for up to 20 or 30 minutes sometimes before Excel will pop up with the data.
During this time, the EXCEL.EXE process is started and using CPU time.
I gather the extension iterates through every field individually and inserts cells one at a time - is this what's making it slow?

Also, the EXCEL.EXE process does not close, even when the document it's viewing is closed... is the COM object still being referenced by the extension, perhaps, even when it's done with it? This can lead to a number of "ghost" EXCEL.EXE processes if you've exported a lot of files.

(The last issue there can be resolved by setting the resulting object from the Export() function to null, then calling a GC.WaitForPendingFinalizers() followed by a GC.Collect())