我正在尝试使用谷歌脚本将公式设置为一个单元格,但它不起作用。我有几个条件和双引号,不知道如何在工作表中添加双引号。
=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))),"")
如何将此公式添加到单元格?
答案 0 :(得分:3)
你试过用单引号简单地包围它吗?
像这样:(更新Range值)
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))),"")')