how to save the data in .xls using php?
Moderator: General Moderators
how to save the data in .xls using php?
HI all
Saving the stored data in .html and .txt is simple. But i am looking for saving the data in excel.
Has anybody tried it out. If yes that would be very helpful to me .
Thanks in advance
Saving the stored data in .html and .txt is simple. But i am looking for saving the data in excel.
Has anybody tried it out. If yes that would be very helpful to me .
Thanks in advance
Last edited by PHPycho on Fri Jan 12, 2007 7:56 pm, edited 1 time in total.
http://pear.php.net/package/Spreadsheet_Excel_Writer might be of interest.
- ambivalent
- Forum Contributor
- Posts: 173
- Joined: Thu Apr 14, 2005 8:58 pm
- Location: Toronto, ON
This is based around output from MySQL but it should point you in a general direction: http://fundisom.com/phpsnippets/snip/da ... _to_excel/
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Bear in mind that XLS and DOC files are binary. Unless you use pear you won't find any standard PHP functions for generating data for those types of files. You have to know the data structure. That second tutorial seems to know it but I must personally I would not fancy writing all my code like that, I'd write a proper loader and saver for PHP that than allowed me to add/change data in the file using objects or functions....what do you know that is exactly what that pear library is!
Pear is the way to go, you won't find anything better.
Pear is the way to go, you won't find anything better.
I have to save the data in simple format , there is no need of calculations and more..
Using pear may be a better idea, but that should be installed and that may be
a x-tra work to carry on. For simple format may be the COM application may be better.
Just i need is a good tutorial of .xls generation using COM objects and PHP.
Thanks in advance
Using pear may be a better idea, but that should be installed and that may be
a x-tra work to carry on. For simple format may be the COM application may be better.
Just i need is a good tutorial of .xls generation using COM objects and PHP.
Thanks in advance
^^ this is the way to go, especially when the data is in "simple format".
PHP has some built in functions to handle csv files:
http://www.php.net/fgetcsv
In excel or OO Calc, you can simply File >> Save As >> .csv
Definately a lot easier than trying to work with .xls files.
peace
PHP has some built in functions to handle csv files:
http://www.php.net/fgetcsv
In excel or OO Calc, you can simply File >> Save As >> .csv
Definately a lot easier than trying to work with .xls files.
peace