php to excel chart?

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
Marchosius2
Forum Newbie
Posts: 3
Joined: Wed Sep 15, 2010 7:23 am

php to excel chart?

Post by Marchosius2 »

Hi all, I am new to this site and hope that some one would be able to help me.

cutting to the chase, i need some way of generating an excel spreadsheet with a dynamic graph from data recieved from a database.
I have been asked to research this.

any one with some advice?
buckit
Forum Contributor
Posts: 169
Joined: Fri Jan 01, 2010 10:21 am

Re: php to excel chart?

Post by buckit »

Marchosius2
Forum Newbie
Posts: 3
Joined: Wed Sep 15, 2010 7:23 am

Re: php to excel chart?

Post by Marchosius2 »

thanx for the reply, through much searching i found a way but not a method.

i have a excel macro that would generate my chart and place my data in. but the method i dont have is to excecute the macro into excel useing php.

any help on this?
Marchosius2
Forum Newbie
Posts: 3
Joined: Wed Sep 15, 2010 7:23 am

Re: php to excel chart?

Post by Marchosius2 »

Can any one help on this? most of the methods online show how to genirate a image file and place that in excel.

I am looking for a method to send the data to excel and make excel genirate the chart and then let the user download that excel doc.
I know how to write data to excel, and make it download to the user. but how can you make excel genirate the chart?


some methods i have thought of would be to send the macros through php to the excel.
or
make a excel file with the chart already in it and then just update the "template" file?
buckit
Forum Contributor
Posts: 169
Joined: Fri Jan 01, 2010 10:21 am

Re: php to excel chart?

Post by buckit »

you are tying to get tomatoes to work with apples. you cant use a scripting language like PHP to control a GUI like excel. the best you could do is use command lines to accomplish your needs... unfortunately excel only has command options (control how it loads and what file to load). You may be able to get something working with the Excel Automation Client. but I have never used it, only know of its existence.

The real question here is why excel and why does the chart need to be generated with a macro? and why excel?

There are TONS of ways to create charts with PHP and even ways of creating excel files with charts. but in terms of using PHP to send data to excel and excel creating a chart, saving the file, and then telling PHP that its ready for download.... I believe you're SOL.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: php to excel chart?

Post by VladSun »

If it's a Windows server you may try using the Excel COM API ...

http://www.php.net/manual/en/class.com.php

though I've never tried it.
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: php to excel chart?

Post by Eran »

http://phpexcel.codeplex.com/
This can be found by the way, by googling "php excel"
Post Reply