Taizooooon
Taizooooon

Reputation: 91

setFormula to a cell using Script is not working

I am trying to setformula to a cell using google script and its not working. I have few conditions and double quotes and dont know how to add double quote to the sheet.

=if(B17<>"",IF(Form!B8 = "","",IF(Form!B8 = "Representative",index(House!A:H,MATCH(B17,House!G:G,0),8),index(House!A:H,MATCH(B17,Senate!G:G,0),8))),"")

How do I add this formula to a cell?

Upvotes: 1

Views: 3290

Answers (1)

Serge insas
Serge insas

Reputation: 46794

have you tried to simply surround it with single quotes ?

like this : (update the Range value)

sheet.getRange(1,1).setFormula('=if(B17<>"",IF(Form!B8 = "","",IF(Form!B8 = "Representative",index(House!A:H,MATCH(B17,House!G:G,0),8),index(House!A:H,MATCH(B17,Senate!G:G,0),8))),"")')

Upvotes: 3

Related Questions