>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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to