I am trying to pro grammatically insert an image into a document. I can get this to work fine with an image with a URL such as http://www.geeks-on-wheels.net/wp-content/uploads/apple.jpg.
The problem comes when trying to use an image located on my Google Drive.
The URL looks like this:
https://docs.google.com/a/finance-in-motion.com/file/d/0B5sPSMZ9pf-QMG9GOVROakxQYmM/edit
or
https://docs.google.com/a/finance-in-motion.com/file/d/0B5sPSMZ9pf-QMG9GOVROakxQYmM/edit?usp=sharing.
The script doesn't seem to know what to do with it and throws an error. Any help would be appreciated.
To insert files from Drive do not use the HTTP route unless the file has been made public via drive hosting
Insert use the built in apis to read the file's blog and insert the img.
Here is an example of inserting a jpg from my drive (or a file I have access to) to a document.
This will insert an image at the top of the document. To get more control over the cursor/selection replacement see this blog post.
I got a task where i have to make a form to upload its data and image to google spreadsheet. So i have created three files to achieve this task on my Google App Script project.
Files: Code.gs (carrying the form handling code)
form.html (carrying the form html code)
thanks.html (show after successfull submission of form)
and on my google drive i have a folder named "uploads" where all the images upload from the form and its link save in to the spreadsheet along with other data of the form. you can check the running app here : https://script.google.com/macros/s/AKfycbwmUDXR54cWO8PbCaexqDDo2397kyAi-AluUwWuhfG0VqTyK5ed/exec and data will save to this spreasheet : https://docs.google.com/spreadsheets/d/12StuWSCebwRBBTxOcYEr8ksHN8PJhtDIE7NWi9UwGf0/edit#gid=0
following are the files code
Code.gs
form.html
thanks.html