Ask YC: Excel Generation (Server Side)?

9 points by erictobia ↗ HN
I was curious to know if anyone could recommend a component for server side excel generation (both xls and xlsx) for an ASP.NET application. We cannot install Office on the server. We've been using this component from codeplex...

http://www.codeplex.com/ExcelPackage

...and we haven't been thrilled with it. We're open to a commercial solution - we're just not sure what the best option is.

Thanks in advance for any suggestions.

14 comments

[ 3.3 ms ] story [ 39.3 ms ] thread
I know of a lib for Python but it only produces xls.

http://sourceforge.net/projects/pyexcelerator

If you are using ASP.NET why can't you install Office on the server?

The latest (licensed) version of Office we have is 2003. As far as we know using Office 2003 for server side Excel generation is not recommended.

Thanks for the link to the Python framework though.

Yes - COM Automation stuff is generally not recommended for non-interactive usage. Although I think many people do get away with it.
Its not recommended but it does work! We managed to get MS Office to kick out around 10-15 documents per second on a single IIS server running ASP.net without much optimization. If you wanted to go crazy you could just load-balance the servers and kick out way more docs.

We tried to use a Java lib for Office docs but it was a pain in the neck. We had some very specific requirements for embedding an ActiveX control into a document and the OSS libs just weren't going to cut it. If your volume requirements aren't too high, I would just start with interoping with MS Office.

Have you looked at the Apache POI project? Not sure if it can do XLSX yet, though.
I haven't had a look at that...looks promising. Right now I'd be looking for something I can use with C#.

Thanks for the suggestion.

XLSX is zipped XMLs, so you might try reverse-engineering. Also consider having a static XLS which imports data from a web-based CSV.
You haven't said what you're trying to put into that Excel spreadsheet. If it's just rows of text, numbers, and formulas, then it's dead simple.

- change your response mime-type to application/excel

- supply a filename ending with .xls

- output comma-separated text.

done.

(it only gets difficult if you need to start embedding charts and specifying fonts)

(it only gets difficult if you need to start embedding charts and specifying fonts)

We do need to do some of this

I've used 2 methods:

1: SpreadsheetML: You can output XML which is understood by excel, here is an introduction: http://msdn.microsoft.com/en-us/library/bb226687(office.11).aspx

2: Insert values into an existing template.xls which is accessed with sql using an Oledbconnection. The template can have existing charts which will get updated with the new values.

When I was at Bank of America I worked on an internal Project Management tool that used a ton of Excel spreadsheets. If you can start with some kind of template it becomes dead simple. Excel spreadsheets can be used as datasources without Excel being installed on the server (iirc). Our app just connected to the XLS and dumped the data into the existing columns. If you have charts based on those columns then you're good to go.

Of course if you can't start with a template or need to add columns on the fly...it might be a little more challenging.

Doesn't CSV work for you? I think Excel even parses formulas in CSVs.