Nate
Nate

Reputation: 11

Using Google Script, how can I insert an image into a table cell?

I have been successful in figuring out how to append an image using the answer below but I need to take it one step further.

https://stackoverflow.com/a/7970134/1208721

Using Google Script in Apps, how do you specifically reference a cell in a table on a google doc and append the image there? I cannot seem to get the syntax right.

Thanks! Nate

Upvotes: 1

Views: 3010

Answers (2)

mzimmerman
mzimmerman

Reputation: 940

Continue using =image as described by Eduardo, but instead of range.setValue() use range.setFormula() Just realize you can't use this from the cell itself, like in =mycustomfunction(args) as in that case, you can only modify the cell contents of the current cell.

Upvotes: 0

Eduardo
Eduardo

Reputation: 22834

Just set the cell formula to this one:

=Image("http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath/images/cp_logo.png")

If you want this image to link somewhere you can even do this:

=HYPERLINK("http://www.cardinalpath.com/",Image("http://www.cardinalpath.com/cpwp/wp-content/themes/cardinalpath/images/cp_logo.png"))

Upvotes: 2

Related Questions