RE: [PHP] db to xls

From: Date: Tue, 24 Apr 2001 15:18:23 +0000
Subject: RE: [PHP] db to xls
Groups: php.general 
Request: Send a blank email to php-general+get-50106@lists.php.net to get a copy of this message
> I want to query an oracle database and push the output to an MS > Excel spreadsheet . Currently I am dumping it to a csv text file and > reading into Excel. > Is there a better way to do this?? Is there a php function for this ?? What I am doing is using PHP to generate an HTML table in the format that I want to display the db results in. Then, at the top of this file, I include the following code: <code_snippet> Header("Content-Disposition: inline; filename=filename.xls"); Header("Content-Description: PHP3 Generated Data"); Header("Content-type: application/vnd.ms-excel; name='excel'"); flush(); </code_snippet> The browser will get those headers, see that it's receiving an excel file and proceed to launch Excel. And Excel is good enough to know and process HTML and your data is displayed appropriately. It's very cool and very easy to implement. Chris

« previous php.general (#50106) next »