PHP/HTML - Export to Excel

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
koolsamule
Forum Contributor
Posts: 130
Joined: Fri Sep 25, 2009 10:03 am

PHP/HTML - Export to Excel

Post by koolsamule »

Hi Chaps,

I have a HTML table, and need to export the contents, with formatting to MS Excel.

Does anyone know of a simple way to do this?
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: PHP/HTML - Export to Excel

Post by papa »

What about Google?

Search and you shall find
koolsamule
Forum Contributor
Posts: 130
Joined: Fri Sep 25, 2009 10:03 am

Re: PHP/HTML - Export to Excel

Post by koolsamule »

I've tried that dude, came across PHPExcel classes, but haven't got a clue how to incorporate them into my existing web app. . . .that's why I'm asking for help. . . .
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: PHP/HTML - Export to Excel

Post by papa »

Well taking existing code and implement it is a simple way of doing it. An even simpler way would be to pay someone to do it for you.
koolsamule
Forum Contributor
Posts: 130
Joined: Fri Sep 25, 2009 10:03 am

Re: PHP/HTML - Export to Excel

Post by koolsamule »

uhh....not really what i'm after, would like to know how to do it myself, rather than pay someone to do it.
socalocmatt
Forum Newbie
Posts: 15
Joined: Tue Nov 03, 2009 12:45 pm

Re: PHP/HTML - Export to Excel

Post by socalocmatt »

I have also been interested in working with this class. I haven't come across a project where I need to use it... yet. I do have their documentation on it:
http://phpexcel.codeplex.com/Release/Pr ... adId=90450
but I have yet to pour over it all and test any type of implementation.

I'm pretty sure that if the solution for every problem was "pay someone else to do it", this forum, and others, would be pretty dead. People are here to learn from one another and not have the answer be "pay someone to do it". Just MO.
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: PHP/HTML - Export to Excel

Post by Mark Baker »

If you're building the HTML from XML/database/array data, then you can just as readily update PHPExcel cells with that information, and then set cell stylings before writing it to xls.
Simply include the library, and instantiate a PHPExcel object. Then you can loop through your data, writing to each row of a worksheet.

There's plenty of examples showing how to populate and format cells in the PHPExcel Tests directory
jaywebguy
Forum Newbie
Posts: 5
Joined: Wed Nov 04, 2009 11:06 am

Re: PHP/HTML - Export to Excel

Post by jaywebguy »

How about outputting the header info as an cvx or xls file.

Here:
http://www.modwest.com/help/kb6-135.html
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: PHP/HTML - Export to Excel

Post by Mark Baker »

jaywebguy wrote:How about outputting the header info as an cvx or xls file.
Simply setting the headers to pretend that it's an xls file doesn't make it one.
And the OP wants the formatting as well as the data - so it needs to be the real thing
Post Reply