use*_*067 4 google-sheets google-apps-script
function test(r,c) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet.getRange(r,c).setBackground("red");
return 1;
}
Run Code Online (Sandbox Code Playgroud)
在电子表格中,我写"= test(row(),column())
这会导致ERROR,并显示以下消息:错误:您无权调用setBackground(第3行).
如果我在脚本中创建另一个函数调用,则没有问题,如下所示:
function test_the_test(){
test(5,4);
}
Run Code Online (Sandbox Code Playgroud)
为什么我不能从电子表格单元调用测试函数?
先感谢您