繁体   English   中英

为每个新标签页/表格设置公式

[英]Set formula for each new tab/sheet

我正在尝试为每个新标签分配一个公式。 元素列表后出现错误代码(缺少)(第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)']

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM