[英]How to use a variable in a string in Google Sheets Script Editor?
I'm a newbie to Script Editor, so I need some help.我是脚本编辑器的新手,所以我需要一些帮助。
function makeitright(){
var app1 = SpreadsheetApp;
var ss1 = app1.getActiveSpreadsheet();
var cred = ss1.getSheetByName("Crédito");
var lastrow = cred.getLastRow();
var formmod = 'ISBLANK('"H"+(lastrow+1)')'')';
I'm trying to write a formula to a single cell.我正在尝试将公式写入单个单元格。 But this formula will always change with a new added row.
但是这个公式总是会随着新添加的行而改变。 So I need the formula to work with the variable that gets the lastrow + 1.
所以我需要公式来处理获得 lastrow + 1 的变量。
Any ideas in how this could be made?关于如何做到这一点的任何想法?
replace代替
'ISBLANK('"H"+(lastrow+1)')'')';
by经过
'ISBLANK(H' + ( lastrow + 1 ) + ')';
To learn more read about how string concatenation works in JavaScript.要了解有关字符串连接如何在 JavaScript 中工作的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.