you can also send the appropraite headers to output directly to excel from the 
browser, i.e something like this:-

<? if($_GET['FORMAT'] == 'XLS'){
header("Content-Type: application/");
header("Content-Disposition: inline; filename=\"file.xls\"");

this needs to be at the very start of the page and before any output to the browser, 
also in this case you'll need to send FORMAT=XLS in the GET array but you can of 
course take that bit out if you want the data to be in excel format always.

if you already have tables outputing to html then this will convert it excel and open 
an excel window and display the tables. Any formating you do to the html will be shown 
in the excel file as well. seems to easy to be true but it is!

change 'inline' to 'attachment' to simply download the file, or give the user the 
choice of what to do.

-----Original Message-----
From: Ramil Sagum [mailto:[EMAIL PROTECTED]
Sent: 20 August 2003 10:23
Subject: RE: [PHP-DB] Saving MySQL data as an Excel Spreadsheet...?

have you tried saving the data as a set of comma separated values (CSV

Microsoft Excel can open/import these files.

> -----Original Message-----
> Sent: Wednesday, August 20, 2003 4:58 PM
> Subject: [PHP-DB] Saving MySQL data as an Excel Spreadsheet...?
> I've just done a search on goolge for this, and found several products
> that do it, but I'm convinced there's gotta be an open source option?
> Anyone able to point me in the right direction with this?

PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to