Image link from Google Drive not working in Google

2019-06-11 06:21发布

问题:

I am trying to use image from my google drive in google script so that it can be used as a header. But it's not working and just shows small thumbnail icon at top. I am using the following code to achieve this:

var gridLogo = app.createGrid(1, 1);

gridLogo.setWidget(0, 0, app.createImage('https://docs.google.com/...'));

Dots are put in above link for privacy purpose.

I have published the site as Web App and can be accessible by myself.

Is there anything I am missing? Please suggest.

Thanks

回答1:

You should try using the permalink of the image:
http://googlesystem.blogspot.fr/2013/02/permalinks-for-google-drive-images.html

the URL need to be changed from this:
http://docs.google.com/file/d/FILEID/edit
to this
http://drive.google.com/uc?export=view&id=FILEID