Re: How do i provide functionality of exporting chart data in various formats similar to toolbar example using php?

105 views
Skip to first unread message

asgallant

unread,
Sep 3, 2012, 8:16:19 PM9/3/12
to google-visua...@googlegroups.com
The first part you can do by modding the PHP script that fetches your data to create a CSV on demand instead of the normal format you output data in.  You can either pass the CSV back to the client as a string or create a CSV file and pass the url of the file back to the client for download.  That will handle the CSV/Excel end if things (since Excel reads CSV files just fine, there is generally no reason to specifically convert data into an xls/xlsx file - plus, doing so can be a bit of a PITA; if your users demand Excel, just rename the extension on the csv file to xls and they will probably never be able to tell the difference).  The web export end of things will probably be trickier to do.  The API has a method of encoding a chart script in a url, which you then set as the src of an iframe, but I haven't found any documentation for it, so I'm not quite sure how to do it.  If you're feeling adventurous, create a test spreadsheet on Google docs and add a chart there, then try to export the chart.  I suspect the HTML it gives you will show some hint of what needs to be done.

On Monday, September 3, 2012 3:30:49 AM UTC-4, pankaj khurana wrote:

Hi,

I have a csv file which i parse through php and create chart data which is used to render different type of charts.

Now I want to provide the functionality where user can export a particular chart data in various formats like csv,excel and can even publish to web page just like the toolbar example given on following link : Toolbar Link

I have analyzed the example and found that the datasource under this were provided as static spreadsheets.

I do not want to convert my data to spreadsheet first as someone suggested in following question: Google chart data table to Excel

And also this approach is not feasible as data is generated dynamically for different set of charts.

Is there any way through which i can make the data export functionality dynamically using php?


Regards,
Pankaj

Reply all
Reply to author
Forward
0 new messages