convert data into excel sheet using php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vidyadoiphode
Forum Newbie
Posts: 14
Joined: Wed Oct 04, 2006 4:46 am

convert data into excel sheet using php

Post by vidyadoiphode »

can anone tell me how to convert data into excel sheet?
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

either write the file as CSV, Excel will open this no problem.

If you want to write a file as a "real" Excel file you will need to use something like

writeexcel package

http://www.bettina-attack.de/jonny/view ... riteexcel/
vidyadoiphode
Forum Newbie
Posts: 14
Joined: Wed Oct 04, 2006 4:46 am

Post by vidyadoiphode »

tell me easiest way because i have so much less time.
csv is also allowed.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

CSV it is then. Hop to it.
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

No point in PMing me vidyadoiphode, better to ask all your questions here.
facets
Forum Contributor
Posts: 273
Joined: Wed Apr 13, 2005 1:53 am
Location: Detroit

Post by facets »

Something like will get your started.

Code: Select all

header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=file.csv);
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
Then echo back your variables.

./Will
Post Reply