0

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

TechPro
  • 331
  • 1
  • 10
  • 29
  • Is it a direct link to the image? I guess you can't link images from Google Docs this way. – Micer Sep 30 '14 at 14:16
  • Yes, this is the direct link to image in Google docs. I tried using the link in Google Drive too, but it didn't work. Any idea what is best way to do it? – TechPro Sep 30 '14 at 14:33

1 Answers1

2

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

Harold
  • 3,297
  • 1
  • 18
  • 26
  • Thanks Micer, I did create permalink as you suggested. It worked. Thanks – TechPro Sep 30 '14 at 15:09
  • @TechPro you are welcome (but I'm not Micer), please mark it solved it it fit your needs. – Harold Sep 30 '14 at 15:37
  • Hi Micer-Harold (ha ha ha...;-) you could have added in your post that the image has to be shared publicly for it to work. I know it is clearly mentioned in the bogspot you refer to but twice is maybe better than none ...*This only works if you've changed the visibility options to "public on the Web" or "anyone with the link" in the Share dialog* – Serge insas Sep 30 '14 at 15:54
  • Sorry Harold, Thank you. It's you 'Harold's suggestion worked'. I did use permalink like this: https://docs.google.com/uc?id=....... Also, I did set visibility option to "anyone with the link" in Share dialog. Sorry, it was my first post so, messed up name. Thanks for your help – TechPro Sep 30 '14 at 16:31