问题描述
我已阅读以下主题:
我有一个非常简单的绑定脚本,它将在附加组件菜单下添加一个菜单项.从我收集到的信息来看,无论用户的 authMode 和您发布的方式如何,这都是可能的脚本.
I have a very simple bound script that will add a menu item under the Add-ons menu. From what I've gathered, this is possible regardless of the users authMode and your way of publishing your script.
function onOpen(e) {
var menu = SpreadsheetApp.getUi().createAddonMenu();
menu.addItem('Alert', 'alert');
menu.addToUi();
}
function alert() {
SpreadsheetApp.getUi().alert('alerted');
}
这适用于所有登录用户,但不适用于匿名用户.以匿名用户身份打开工作表时,菜单选项甚至不存在.正如上面第二篇文章中所建议的,我还创建了一个可安装触发器对于我的 onOpen 函数,但它仍然不起作用.可安装触发器应以创建脚本的用户身份运行,并且我已对其进行授权.
This works for all logged in users, but not for anonymous users. When opening the sheet as an anonymous user, the menu option isn't even there. As suggested in the second post above, I have also created a installable trigger for my onOpen function, but it still doesn't work. A installable trigger should run as the user who created the script, and I have authorized it.
我也将链接分享为知道链接的每个人都可以编辑".我是不是误解了什么?感觉这应该不是什么大麻烦.
I also have shared the link as "Everyone with the link can edit". Have I misinterpreted something? It feels like this shouldn't be a big hassle.
任何帮助将不胜感激.如果您需要更多信息以提供帮助,请告诉我,我会提供.
Any help would be greatly appreciated. If you need any more information to help, please tell me and I will provide it.
推荐答案
匿名用户根本无法访问或运行脚本,除非它们被部署为 Web 应用程序,即使这样也只有匿名用户可以访问前端.
Scripts cannot be accessed or run at all by anonymous users, unless they are deployed as a Web App, and even then only the front end is accessible by an anonymous user.
您会在绑定的脚本中看到,未登录的用户甚至无法通过单击工具 -> 脚本编辑器访问脚本编辑器(但所有登录用户都可以).此外,如果您的云端硬盘中有一个独立的脚本,并且您右键单击并共享到网络上的任何人都可以编辑",则匿名用户仍然需要登录.
You'll see in your bound script that users who are not logged in cannot even access the script editor by clicking tools -> Script Editor (But all logged in users can). Additionally, if you have a standalone script in your Drive, and you right click and share to 'Anyone on the web can edit', anonymous users are still required to login.
这篇关于Google App Script - 允许匿名用户访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!