how to copy IMAGE from a google spreadsheet to a g

2019-09-17 20:37发布

问题:

My script at https://github.com/berteh/SheetsToDocsMerge/blob/master/merge.gs is inserted in a google spreadsheet to use it as a "mail-merge" source that duplicates a google document (template given by its ID) and substitutes some placeholders between brackets "[variable-name]" with the corresponding cell content of the spreadsheet.

I want to be able to include images dynamically into the resulting document as weel. Providing either the URL of the image in the spreadsheet, or the image itself (using the =IMAGE(URL)), but find no way to

  1. detect if source cell content is an image and
  2. generate content in the output document that will result in the image being included.

Any idea how to do so? thanks! Berteh.