0
votes

lets say I have a column of URLs in A, I would like to have a script that would insert a formula into the next column over so that it would look like the attached image.

I know how to insert a formula into a single cell through script, but unsure of how to get it down the entire column relative to the cell to the left.

2

2 Answers

0
votes

You can use array formula like this:

=ARRAYFORMULA(IMAGE(A2:A))

or you can wrap it in an if statement to only pull in the images where there is a valid url present with:

 =ARRAYFORMULA(IF(ISURL(A2:A),IMAGE(A2:A),))
0
votes

ArrayFormula is good solution. I prefer limiting the used range by it's size. If your data has no blanks, you could also use this formula:

=ARRAYFORMULA(IMAGE(OFFSET(A2,,,COUNTA(A:A)))

Paste it in cell B2.

offset + counta will give range A2:A6 in your case.