谷歌脚本openById:你没有执行该操作的权限 [英] google script openById : You do not have permission to perform that action

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

问题描述

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

  var ss = SpreadsheetApp.openById(otherSpreadsheetId); 

查看执行记录,我得到以下错误:


SpreadsheetApp.openById([0AjqSnE_p3nFqdDN0LWpFbjFqVDRwNmFGOV91QzZrZc])
[0秒]执行失败:您无权执行
该操作。


当我在调试器中直接运行函数时,我成功地打开了另一个电子表格。当函数由onEdit事件运行时,我得到错误。



我需要启用特定的API吗?


安装触发器

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

@kusi将答案作为评论,只是在这里添加它。


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 seconds] Execution failed: You do not have permission to perform that action.

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.

Do I need to enable a particular API?

解决方案

Installable Triggers

There are two types of OnEdit trigger. Installable triggers are able to 'alter another file', see: developers.google.com/apps-script/guides/triggers/installable

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

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

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