Page 1 of 1

HELP with a Export to Excel Button

Posted: Thu Apr 26, 2007 12:44 pm
by StaticConvulsioN
Hello, i have a web page that works with a database, and i print database reports, but now i need a button,
that exports those reports to excel, does anyone now how to do this, im using plain php, plz i need help thnxs,
im not too knowledgeable with php, so i need help to understand how to do this

THNXS.

Posted: Thu Apr 26, 2007 1:18 pm
by aaronhall
The simplest way to do it is to export as a CSV (comma-separated values) file, which is just a plain text file. If I remember correctly, Excel is pretty lenient when it comes to format, but a row would normally have its values enclosed in double quotes and separated by commas or tabs. Rows are terminated with \n or \r\n.

Posted: Thu Apr 26, 2007 2:59 pm
by timvw
Most php developers are better in generating html than csv.. So i would consider the simplest way to generate a html table that represents the excel sheet... If the file is stored with an xsl extension excel will happily open it ;)

Posted: Thu Apr 26, 2007 3:24 pm
by aaronhall
I didn't know that, but when I tried it out, excel was displaying it without borders.