google-apps-script - 有没有一种方法可以让我从谷歌幻灯片中应用程序脚本的 onOpen 函数中运行 SlidesApp.openById() ?
问题描述
function onOpen() {
// Add a custom menu to the google slide.
let menu = SlidesApp.getUi().createMenu('EditAddon')
menu.addItem('Edit Text', 'editText')
menu.addToUi();
}
这是我的 onOpen 函数,它工作正常。但是当我把它改成下面的代码时,
function onOpen() {
// Add a custom menu to the google slide.
let menu = SlidesApp.getUi().createMenu('EditAddon')
menu.addItem('Edit Text', 'editText')
menu.addToUi();
const slides = SlidesApp.openById("myslideidgoeshere").getSlides();
}
我收到一条错误消息,说“例外:您无权调用 SlidesApp.openById。所需权限:https ://www.googleapis.com/auth/presentations at onOpen ”
我浏览了一些参考资料,发现我需要在清单文件中添加权限。而且,也这样做了。下面的代码来自我的清单文件(appsscript.json)。
{
"oauthScopes": [
"https://www.googleapis.com/auth/presentations.readonly",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/presentations"
],
"timeZone": "Asia/Kolkata",
"dependencies": {},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}
但我仍然面临同样的问题。我需要的是,当用户安装我的插件时,他应该被重定向到 googleslides,其中打开了所谓的演示文稿。有没有人可以帮助我解决这个问题?
解决方案
推荐阅读
- c++ - 'int'之前的预期主表达式 - 我该如何解决这个问题?
- java - Thymeleaf:属性文件中的占位符
- python - 使用 yaml aws AttributeError 启动 Ray 集群:“Worker”对象没有属性“worker_id”
- sql - SQL 语句中的提示
- c++ - 唯一指针和双重列表:插入问题
- c# - 为什么在我的 C# 代码中 MD5 会比 SHA256 慢?
- c# - 在 asp.net mvc 中不显示 ajax 调用的图像列表
- amazon-web-services - 我可以使用 AWS Lambda 来满足我的要求吗?
- python-3.x - 部署时找不到 Heroku 命令
- mysql - mysql 加入 3 个表,但“COUNT”重复