export chart into google app script and create docs file

60 views
Skip to first unread message

man...@rocketshp.com

unread,
Mar 1, 2016, 5:54:50 PM3/1/16
to Google Visualization API
Hey guys,

I am trying to export a chart into a google app script web app. I can send normal strings as an ajax request and create a docs file with the input of the parameters.

My idea was now to call chart.getImageURI() and send the uri with an ajax request to the google app script. 
In the google script I want to get the image with UrlFetchApp.fetch(img).

The problem is that the uri of the chart is to big and I always get errors from the ajax request.
I tried to shorten the url with bit.ly but there is also an error, that the url is to long.

I hope somebody can help me!

Thanks in advance,
Manuel

Daniel LaLiberte

unread,
Mar 2, 2016, 3:17:05 PM3/2/16
to Google Visualization API
We are not sure that the issue is the length of the URL.  If you could generate a very small chart, that should result in as smaller URL, just to test that question.  If it works, then it seems your only recourse is to figure out how to generate smaller URLs, perhaps with charts that have fewer details rather than being merely smaller.

The problem is more likely to be that the URL that is generated uses the 'data' scheme, rather than the typical 'http' scheme of most URLs, and this would have to be handled on the Apps Scripts server, which might not work as you expected.

You are probably better off asking on an Apps Scripts forum, since we don't know much about it here.

Hope that helps.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/de2530bd-c4b7-4515-afe0-9087a623f2ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

man...@rocketshp.com

unread,
Mar 2, 2016, 4:36:37 PM3/2/16
to Google Visualization API
Thanks for your suggestion. I created a very small chart and send it with an ajax request. It is working!
So the problem is the length of the url or the data size of the image.


Am Donnerstag, 3. März 2016 09:17:05 UTC+13 schrieb Daniel LaLiberte:
We are not sure that the issue is the length of the URL.  If you could generate a very small chart, that should result in as smaller URL, just to test that question.  If it works, then it seems your only recourse is to figure out how to generate smaller URLs, perhaps with charts that have fewer details rather than being merely smaller.

The problem is more likely to be that the URL that is generated uses the 'data' scheme, rather than the typical 'http' scheme of most URLs, and this would have to be handled on the Apps Scripts server, which might not work as you expected.

You are probably better off asking on an Apps Scripts forum, since we don't know much about it here.

Hope that helps.
On Tue, Mar 1, 2016 at 5:54 PM, <man...@rocketshp.com> wrote:
Hey guys,

I am trying to export a chart into a google app script web app. I can send normal strings as an ajax request and create a docs file with the input of the parameters.

My idea was now to call chart.getImageURI() and send the uri with an ajax request to the google app script. 
In the google script I want to get the image with UrlFetchApp.fetch(img).

The problem is that the uri of the chart is to big and I always get errors from the ajax request.
I tried to shorten the url with bit.ly but there is also an error, that the url is to long.

I hope somebody can help me!

Thanks in advance,
Manuel

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.



--
Reply all
Reply to author
Forward
0 new messages