简体   繁体   English

使用 Google Apps Script 将图像从 Google Sheets 复制到 Google Docs

[英]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 也无法检索图像。

Reference:参考:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Google Apps 脚本从 Google 表格加载图像 - Load Image from Google Sheets using Google Apps Script 使用Apps脚本从Google云端硬盘将图像插入Google表格 - Inserting Image into Google Sheets from Google Drive using Apps Script 使用Apps脚本从Google文档向Google网站添加图像 - Adding an image to a Google site from Docs using Apps Script 使用 Apps 脚本将 Google 表格中的链接表插入 Google 文档 - Insert linked table from Google Sheets into Google Docs using Apps Script HTML 从 Google 表格到 Google Apps 脚本上的 Google Drive 的图像 - HTML to Image from Google Sheets to Google Drive on Google Apps Script Google Apps 脚本/Google 表格 - 仅复制 IF - Google Apps Script/ Google Sheets - Only copy IF 使用 Google Apps 脚本从 Google Sheets 数据表复制到 Google 文档表 - Using Google Apps Script to Copy from Google Sheets Data Table to Google Documents Table 使用 Google Apps Script 将 .CSV 文件数据复制到 Google 表格 - Using Google Apps Script to copy .CSV file data to Google Sheets 使用Google Apps脚本从Google Firebase写入Google表格 - Write from Google Firebase to Google Sheets using Google Apps script 在 google 应用程序脚本中使用 google docs api - using google docs api from within google apps script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM