RE: Saving MySQL data as an Excel Spreadsheet...?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/vnd.ms-excel");
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:ramil@astra.ph]
Sent: 20 August 2003 10:23
To: php-db@lists.php.net
Subject: RE:  Saving MySQL data as an Excel Spreadsheet...?


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

Microsoft Excel can open/import these files.

> -----Original Message-----
> From: Tristan.Pretty@risk.sungard.com
> [mailto:Tristan.Pretty@risk.sungard.com]
> Sent: Wednesday, August 20, 2003 4:58 PM
> To: php-db@lists.php.net
> Subject:  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 (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux