Page 1 of 1

How can i create an xls file

Posted: Mon Dec 28, 2009 11:34 pm
by Dilbert137
Dear All,

I'm searching for a coding which can make me create xls file from a database fields and that the client can save the data in xls.

Thanks
Dilbert137

Re: How can i create an xls file

Posted: Tue Dec 29, 2009 2:30 am
by omniuni
Not to say it's impossible, but it is far easier to export as a CSV, and import that into your spreadsheet of choice.

http://php.net/manual/en/function.fputcsv.php

Re: How can i create an xls file

Posted: Tue Dec 29, 2009 8:28 am
by bjazmoore
To make a file that Excel will open nativly (when you double click the file) simply seperate your data with a tab (ASCII 9) and then save the file with an XLS extension. It will not have any special formatting, but excel will happily open it.

Re: How can i create an xls file

Posted: Tue Dec 29, 2009 9:27 am
by Darhazer
You can use the PHPExcel library