Page 1 of 1
PHP/Oracle need code to Export a resulted query to Excel.
Posted: Thu May 26, 2005 9:55 am
by cforant
Currently we are displaying the result of an ORACLE query on a php page. We would like to export the results of that stored query to an excel spreadsheet with the touch of a button/link.
Anybody ever do this???

Posted: Thu May 26, 2005 10:06 am
by shiznatix
Code: Select all
<?php
header("Content-Type: application/vnd.ms-excel");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
?>
those headers should retun the output as a excell spreadsheet style then you can just catch all the data outputted and save it to a file i suppose, never done it but why wouldnt it work
help!!!!!!!
Posted: Fri May 27, 2005 8:56 am
by cforant
Is there anyone out there that knows how this works???

Posted: Fri May 27, 2005 10:09 am
by pickle
You can get classes that will allow you to create excel spreadsheets. Look at PEAR for a decent one.
Usually, I just export as a comma separated file, then import it into Excel. As cool as making an Excel spreadsheet is, it's quite a bugbear to get working flawlessly (in my experience).
Posted: Fri May 27, 2005 10:49 am
by JAM
pickle wrote:You can get classes that will allow you to create excel spreadsheets. Look at PEAR for a decent one.
Usually, I just export as a comma separated file, then import it into Excel. As cool as making an Excel spreadsheet is, it's quite a bugbear to get working flawlessly (in my experience).
As said, there is alot of premade classes for this (why reinvent the wheel?). I've used
BiffWriter briefly once, and it worked well.
Posted: Wed Jun 01, 2005 7:25 am
by cforant
I am not having any luck with these suggestions. I may be utilizing them incorrectly.
The situation again is...I already have a saved query displaying on a results page, I just want the php code to insert into my code that will allow me to export that query into a spreadsheet, cvs, xls, anything. Please help.