[英]Copy image from Google Sheets to Google Docs using Google Apps Script
I was working on generating a report as Google Docs document using data from spreadsheets.我正在使用电子表格中的数据将报告生成为 Google Docs 文档。 Some parts of the sheets contain a step-by-step screenshot walkthrough (That is, text, image, text, image vertically).
工作表的某些部分包含分步截图演练(即文本、图像、文本、垂直图像)。 That needs to be copied to the doc.
这需要复制到文档中。
I have read through Google Apps Script reference and found that OverGridImage
represent the image in the file.我已阅读 Google Apps Script 参考,发现
OverGridImage
代表文件中的图像。 However, there was no method that allows exporting as a blob, or even a URL.但是,没有允许导出为 blob 甚至 URL 的方法。 (Since the image pasted on the sheets come directly from clipboard, there is no URL of the image in the first place, so
getUrl()
does not work.) (由于粘贴在工作表上的图像直接来自剪贴板,因此首先没有图像的 URL,因此
getUrl()
不起作用。)
Is there any workaround that is possible?有没有可能的解决方法?
I'm afraid what you're trying to do is currently not possible .恐怕你正在尝试做的事情目前是不可能的。
The class OverGridImage was released fairly recently ( October 2018 ) and, as you said, there is no way to retrieve the Blob for such images. OverGridImage类最近发布( 2018 年 10 月),正如您所说,无法检索此类图像的 Blob。 There is actually an open Feature Request in Issue Tracker regarding this.
在问题跟踪器中实际上有一个关于此的开放功能请求。
Since there is no BlobSource interface related to this class, there is no way to get a reference of that image, if you have no URL.由于没有与此类相关的BlobSource 接口,因此如果您没有 URL,则无法获取该图像的引用。 And the image cannot be retrieved by Sheets API either.
并且 Sheets API 也无法检索图像。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.