Create Excel (.XLS and .XLSX) file from C#
- by mistrmark
What is the best tool for creating an Excel Spreadsheet with C#.
Ideally, I would like open source so I don't have to add any third party dependencies to my code, and I would like to avoid using Excel directly to create the file (using OLE Automation.)
The .CSV file solution is easy, and is the current way I am handling this, but I but I would like to control the output formats.
EDIT: I am still looking at these to see the best alternative for my solution. Interop will work, but it requires Excel to be on the machine you are using. Also the OLEDB method is intriguing, but may not yield much more than what I can achieve with CSV files. I will look more into the 2003 xml format, but that also puts a Excel 2003 requirement on the file.
I am currently looking at a port of the PEAR (PHP library) Excel Writer that will allow some pretty good XLS data and formatting and it is in the Excel_97 compatible format that all modern versions of Excel support. The PEAR Excel Writer is here: PEAR - Excel Writer