1

Possible Duplicate:
How can I programatically create, read, write an excel without having office installed?

Can i create a Microsoft Excel file without using Microsoft Office Interop Assembly? I need to export all the values in a sql server table to an Excel file. Total number of rows can vary between 50000 to 1200000 rows. I need to generate the Excel file from my C#.net code where i will read the values of the table. The only restriction i have is I cannot use Microsoft Office Interop Assembly.

I can't use CSV, or use the HTML table trick, because some of the files will contain multiple tabs, where each tabs will contain data from different tables.

Community
  • 1
  • 1
user1242496
  • 139
  • 2
  • 8
  • http://stackoverflow.com/questions/1369361/how-can-i-programatically-create-read-write-an-excel-without-having-office-ins/1369413#1369413 – Gregoire Oct 31 '12 at 17:52

2 Answers2

2

Your best bet might be to just export your data in a CSV file. This is beneficial for a number of reasons:

  1. CSVs are generally smaller than excel workbooks (read: faster to create via code)
  2. Excel can open CSVs just like normal documents and edit them and such.
  3. It will be very simple to create a CSV using a few loops and some elbow grease in C#.

The only downfall to this is if you were somehow planning on formatting your data, especially before you got it into a workbook form.

Jamal
  • 763
  • 7
  • 22
  • 32
Josh Bibb
  • 477
  • 4
  • 14
1

You could use this:

http://netoffice.codeplex.com/

Features are (but not only) :

  • All features of the Office versions 2000, 2002, 2003, 2007, 2010, 2013 are included.
  • No dependencies, no interop assemblies, no need for VSTO
  • Syntactically and semantically identical to the Microsoft Interop Assemblies
Pablo Claus
  • 5,886
  • 3
  • 29
  • 38