首页 > 解决方案 > Appscript setformula 解析错误。但似乎工作

问题描述

我正在尝试使用此代码在谷歌电子表格单元格中设置公式

function SetFormuleSettimana(row) {

   var ss = SpreadsheetApp.getActiveSpreadsheet();
   var Settimane = ss.getSheetByName("Settimane"); 

   var cell = Settimane.getRange("I" + row);

   cell.setFormulaR1C1('ArrayFormula(Indice(Gruppi!A:G;Confronta(1;(G' + row + '=Gruppi!A:A)*(H' + row + '=Gruppi!B:B);0);5))');
}

单元格似乎正确填充了公式=ArrayFormula(Indice(Gruppi!A:G;Confronta(1;(G2=Gruppi!A:A)*(H2=Gruppi!B:B);0);5))

但我得到一个“解析错误”,分析电子表格中的公式帮助给出正确的值。

在此处输入图像描述

标签: google-sheets-api

解决方案


使用非英语语言的 Apps 脚本设置公式时出现问题。

要以编程方式设置公式,同时您需要使用公式的相应英文名称。


推荐阅读