google 脚本 openById :您无权执行该操作 [英] google script openById : You do not have permission to perform that action

查看:30
本文介绍了google 脚本 openById :您无权执行该操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

电子表格中的事件驱动脚本打开另一个电子表格

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?

推荐答案

Installable Triggers

OnEdit 触发器有两种类型.可安装的触发器能够更改另一个文件",请参阅:https://developers.google.com/apps-script/guides/triggers/installable

提供@kusi答案作为评论,只需在此处添加即可.

@kusi supplied the answer as a comment, just adding it here.

这篇关于google 脚本 openById :您无权执行该操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆