为每个新标签/工作表设置公式



我正在尝试为每个新选项卡分配一个公式。我在元素列表后收到错误代码(缺少]。(第 10 行,文件"代码"(

function makeTabs() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var last = sheet.getLastRow();//identifies the last active row on the sheet
//loop through the code until each row creates a tab.
for(var i=1; i<last; i++){
var tabName = sheet.getRange(i+1,9).getValue();//get the range in column I and get the value.
var create = ss.insertSheet(tabName);//create a new sheet with the value
var formulas = [
  ['=transpose('Form Responses 1'!J2:O2)'],
  ['=Arrayformula(IF(A2:A="",,VLookup(A2:A,ImportedData!A1:S,{2,11,15,18,17,19},0)))']] ;

var cell = sheet.getRange("A2:B2");
cell.setFormulas(formulas);
}
}

我哪里出错了?谢谢!!

尝试像这样转义内部单引号:

['=transpose('Form Responses 1'!J2:O2)']

相关内容

最新更新