Export my Google Chart (table) data to excel or cs

2019-06-21 23:34发布

问题:

I have a google chart which is a table and I need to have an option to export the data to excel or csv.

Can this be done within google charts API? I found a few pages with code but that was with the data coming from google docs where as my data is coming from mySQL. My table also has some StringFilters so the exported data should only be the data left after filtering.

If this can't be dont via the API what would be the best way to do this... Can I get the filtered data into any other format that I can use?

Any help is much appreciated Thanks

回答1:

Upload to a Google Spreadsheet using PHP (you may want to use ajax for this) or server side language of your choice and convert to Excel from there.

OR

Use the built in toolbar functionality:

https://developers.google.com/chart/interactive/docs/gallery/toolbar