google script openById :您无权执行该操作 [英] google script openById : You do not have permission to perform that action
问题描述
电子表格中的事件驱动脚本会打开另一个电子表格
An event driven script in a spreadsheet opens another spreadsheet
var ss = SpreadsheetApp.openById(otherSpreadsheetId);
查看执行记录,我收到以下错误
Looking at the execution transcript, I get the following error
SpreadsheetApp.openById([0AjqSnE_p3nFqdDN0LWpFbjFqVDRwNmFGOV91QzZrZc])[0 秒] 执行失败:您无权执行那个动作.
SpreadsheetApp.openById([0AjqSnE_p3nFqdDN0LWpFbjFqVDRwNmFGOV91QzZrZc]) [0 seconds] Execution failed: You do not have permission to perform that action.
当我直接在调试器中运行该函数时,我成功打开了另一个电子表格.当函数由onEdit"事件运行时,我得到错误.
When I run the function directly in the debugger, I successfully open the other spreadsheet. When the function is run by an "onEdit" event, then I get the error.
我需要启用特定的 API 吗?
Do I need to enable a particular API?
推荐答案
可安装触发器
有两种类型的 OnEdit 触发器.可安装的触发器能够更改另一个文件",请参阅:https://developers.google.com/apps-script/guides/triggers/installable
@kusi 提供答案作为评论,只需在此处添加即可.
@kusi supplied the answer as a comment, just adding it here.
这篇关于google script openById :您无权执行该操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!