简体   繁体   中英

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. 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. However, there was no method that allows exporting as a blob, or even a 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.)

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. 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. And the image cannot be retrieved by Sheets API either.

Reference:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM