How to programmatically create a “true” Excel file

calendar_today Asked Apr 5, 2012
thumb_up 10 upvotes
history Updated April 16, 2026

Question posted 2012 · +6 upvotes

Possible Duplicate:
Generating an Excel file in ASP.NET

Here’s my question: How do you programmatically create a “true” Excel file?

Note: I don’t mean a CSV, HTML/CSS, or XML file, I mean a file written in the same format Excel uses to save spreadsheets.

Background: I’m working on an ASP.Net application, which includes Telerik’s RadGrid. We’re currently using the RadGrid’s ExportToExcel() function, but some of our customers need to be able to view these exports using Excel Viewer. Telerik’s function exports an HTML/CSS-based file, which the full-version of Excel can open, but Excel Viewer cannot.

I’m sure its possible to programmatically create a “true” Excel file, but I’m not sure where to begin. Is there an SDK which could help me do this?

Any suggestions would be appreciated. Thanks in advance.

Accepted answer +10 upvotes

You can use the interop from Excel like RedFilter showed you, but there are also open source alternatives that does not require Excel to be installed on your pc to work. It can be useful if you have a asp.net project deployed on a server that does not have Excel.

EPPlus is a good library. http://epplus.codeplex.com/

Personnally, I use Koogra. http://sourceforge.net/projects/koogra/?_test=b

External references cited (2)

Top excel Q&A (6)

+10 upvotes ranks this answer #78 out of 167 excel solutions on this site .