【发布时间】:2020-12-12 18:08:39
【问题描述】:
我写了一个添加全天事件的函数。
当函数从脚本编辑器运行正常时,全天事件被插入到日历中。
但是当我在活动电子表格=addevent(a1,b1,c1,d1)中运行函数时
我收到一条错误消息:
例外:脚本无权执行该操作。所需权限:(https://www.googleapis.com/auth/calendar || https://www.googleapis.com/auth/calendar.readonly || https://www.google.com/calendar/feeds)(第 11 行)
在网上搜索后,我发现如何通过编辑 JSON 文件中的 oauthScopes 手动添加这些权限:
{
"oauthScopes": [
"https://www.googleapis.com/auth/calendar",
"https://www.googleapis.com/auth/calendar.readonly",
"https://www.google.com/calendar/feeds",
"https://www.googleapis.com/auth/spreadsheets.currentonly",
"https://www.googleapis.com/auth/spreadsheets"
],
"timeZone": "censored",
"dependencies": {
"enabledAdvancedServices": [{
"userSymbol": "Calendar",
"serviceId": "calendar",
"version": "v3"
}]
},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}
但我仍然在电子表格中遇到同样的错误...
【问题讨论】:
标签: google-apps-script google-sheets permissions google-calendar-api custom-function