How to use <img src > in google apps script
google-apps-script, html
Solution
The `img src=""` requires the URL of the actual image you want to display, not the folder that contains it. To get the correct link you need to open the picture in its own window or click share and get the link that way.
The correct link for your image is:
https://drive.google.com/file/d/0ByNw-B9nXMcbSTN2S2ZiYWprdzA/view
To use this in the src you need to add the fileID to the end of this format URL:
https://drive.google.com/uc?export=download&id=
So it becomes:
https://drive.google.com/uc?export=download&id=0ByNw-B9nXMcbSTN2S2ZiYWprdzA
NOTE: The drive file must be shared with 'anyone with the link' for other users to be able to view the file or for use outside of G Suite.
Problem
I want to display the image in a google apps script using src attribute. I put the folder id and the path. But the image couldn't display. I shared the folder here. Thank you for your help! https://drive.google.com/drive/folders/0ByNw-B9nXMcbMkxHTGt2X2xUTzQ ``` function doGet() { var html = HtmlService.createTemplateFromFile('index').evaluate() .setTitle('picture').setSandboxMode(HtmlService.SandboxMode.NATIVE); return html; } <!DOCTYPE html> <html> <head> <base target="_top"> </head> <body> <p> Dispaly picture </p> <p><img src="https://drive.google.com/drive/folders/0ByNw-B9nXMcbMkxHTGt2X2xUTzQ/200w.gif"> </p> </body> </html> ```