讨厌的权限问题
Pesky permission issue
我在 Google App Script 中写了一个非常简单的函数:
function addProduct(number) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow([number, number+1])
}
并尝试通过在单元格中输入 =addProduct()
在 Google 电子表格中 运行 它。然而,Google 电子表格给了我一个错误,我没有 权限 来调用函数 appendRow()。
这是为什么?
- 每个自定义函数都必须 return 一个值才能显示。
- 自定义函数不能影响它 return 为其赋值的单元格以外的单元格。换句话说,自定义函数不能编辑任意单元格,只能编辑调用它的单元格及其相邻单元格。要编辑任意单元格,请改用自定义菜单 运行 函数。摘自:Google Developers
我在 Google App Script 中写了一个非常简单的函数:
function addProduct(number) {
var sheet = SpreadsheetApp.getActiveSheet();
sheet.appendRow([number, number+1])
}
并尝试通过在单元格中输入 =addProduct()
在 Google 电子表格中 运行 它。然而,Google 电子表格给了我一个错误,我没有 权限 来调用函数 appendRow()。
这是为什么?
- 每个自定义函数都必须 return 一个值才能显示。
- 自定义函数不能影响它 return 为其赋值的单元格以外的单元格。换句话说,自定义函数不能编辑任意单元格,只能编辑调用它的单元格及其相邻单元格。要编辑任意单元格,请改用自定义菜单 运行 函数。摘自:Google Developers