[英]calculate cells in app script to using in google sheet
I have this function and run good:我有这个 function 并且运行良好:
function total(x,y)
return x + y;
}
in google sheet I add in any cell =total(A1,B1)
and give me result.在谷歌工作表中,我添加了任何单元格
=total(A1,B1)
并给我结果。
I want to do same that to calculate a lot of cells by this code:我想通过这段代码来计算很多单元格:
function total(x)
return x;
}
in google sheet I add in any cell =total(A1:A100)
and give me error.在谷歌表中,我添加了任何单元格
=total(A1:A100)
并给我错误。 any help for that problem.对那个问题的任何帮助。
function myTotal(a) {
let r = a.flat().filter(e => e && !isNaN(e));
if(r && r.length ) {
return r.reduce((a, c) => a += Number(c));
} else {
return '';
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.