Re: Export to Spreadsheet Format
| From: | Richard Lynch | Date: | Wed, 24 Jan 2001 00:09:08 +0000 |
| Subject: | Re: Export to Spreadsheet Format | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-36297@lists.php.net to get a copy of this message | ||
>I want to run a query on a database and export the recordset to a
>spreadsheet, preferably Excel native.
>
>The box is on a Win32 OS, so I can instantiate a Excel COM object (similar
>to the PHPBuilder COM article), and use the COM methods to create an Excel
>file.
>
>Or, I can fopen and fput a CSV formatted file ready to import into Excel.
>
>My question is this: can anyone recommend a script/class where this has
>already been done? Thanks, PHP list.
Because the CSV format gets real gnarly real fast with nested commas and
quotes, you may find tab-delimited easier...
while($row = xxx_fetch_row($result)){
$line = explode("\t", $row);
fputs($file,$line);
}
eXcel can import tab-delimited real easy.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm