SpreadsheetApp how to use variable inside formula

2019-07-10 00:27发布

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条回答
贼婆χ
2楼-- · 2019-07-10 01:05
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.

查看更多
登录 后发表回答