SpreadsheetApp how to use variable inside formula

馋奶兔 提交于 2019-12-20 03:18:05

问题


I want to be able to put my variable row into the

.setValue("=SUM(B54:BA54)")

Actually I need the value of row to replace B54:B54. I'm looking for something like

.setValue("=SUM(B+row+:BA+row)")

So if row = 50 the setValue will put =SUM(B50:BA50) in the cell

var text3 = result3.getResponseText();
var row = parseInt(text3);
activeSheet.getRange(row+3,55).setValue("=SUM(B54:BA54)");

回答1:


var text3 = result3.getResponseText();
var row = parseInt(text3);
activeSheet.getRange(row+3,55).setValue("=SUM(B" + row + ":BA" + row + ")");

using concatenation should work like you want it.



来源:https://stackoverflow.com/questions/47704060/spreadsheetapp-how-to-use-variable-inside-formula

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!