I remember dealing with this problem a few years ago. At that time, I didn’t know better so ended up generating tab delimited files. A few years later, I finally gain my dignity back by generating real excel files.
I found many libraries out there, below are a few:
Ruby roo: http://roo.rubyforge.org/
Ruby spreadsheet: http://spreadsheet.rubyforge.org/
Apache POI (Java): http://poi.apache.org/index.html
Pear Spreadsheet_Excel_Writer (PHP): http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.php
Python Excel: http://www.python-excel.org/
I believe they will all work just fine as they all look promising.
I played with PHPExcel a little. It’s pretty good in what it does. If you are not going with crazy charts and formulas, PHPExcel should be more than enough for you. It also comes with many sample php files. Recommended!