相关疑难解决方法(0)

用于汇总数据未更新的脚本

我有一张时间表数据的Google电子表格; 它每个月都有一张表,每张表有很多六个列块,每个客户一个块.

我创建了一个摘要表,其中包含每个客户的总数并将其显示在列表中:

function getClientTotals(sheetname, colcount)
{  
  colcount = colcount ? colcount : 6;
  var res;      
  var ss = SpreadsheetApp.openById('myid_goes_here');
  if(ss)
  {
    res = [];
    var totrow = ss.getRange(sheetname + '!A1:ZZ1').getValues()[0];
    for(var i = 0; i < totrow.length; i += colcount)
    {
      res.push([totrow[i], totrow[i + colcount - 1]]);
    }
  }   
  return res;
}
Run Code Online (Sandbox Code Playgroud)

然后我在我的摘要表中添加了一个单元格,=getClientTotals($C$7,$C$8)其中包含月份工作表名称和每个客户端的列数(如果是"模式"修改).

这一切都正常,但是,当源数据发生更改时,它不会更新.我添加了一个onEdit触发器; 没有快乐.如果您转到脚本编辑器并点击"保存",它会更新,但这没有用.我错过了什么吗?

google-apps google-sheets google-apps-script custom-function

14
推荐指数
1
解决办法
2万
查看次数