This code works for inserting an image
But I want to fetch the url from a google sheet. I put "UrlFetchApp.fetch("sourceSheet.getActiveCell().getValue()");"
in the code below to show my thinking on how to solve this...
function insertImage() {
// Retrieve an image from the web.
var resp = UrlFetchApp.fetch("sourceSheet.getActiveCell().getValue()");
// Create a document.
var doc = DocumentApp.openById("1qWnGAR_WBpHkSdY5frld0VNfHtQ6BSzGxlzVNDi5xMk");
// Append the image to the first paragraph.
doc.getChild(2).asParagraph().appendInlineImage(resp);
}
The end goal is that I have a sheet with the ID of the doc in one column and the ulr of the image to insert in the other column. I want the script to run so that I can insert each image into each doc.