【发布时间】:2013-11-06 17:11:43
【问题描述】:
此代码适用于插入图像
但我想从谷歌表格中获取网址。我把 "UrlFetchApp.fetch("sourceSheet.getActiveCell().getValue()");"
在下面的代码中展示我对如何解决这个问题的想法......
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);
}
最终目标是我有一张表格,其中一列中包含文档的 ID,另一列中插入图像的 ulr。我希望脚本运行,以便我可以将每个图像插入到每个文档中。
【问题讨论】:
标签: google-apps-script google-sheets