Google Apps脚本-电子表格编辑器可以从库中运行脚本的功能 [英] Google Apps Script - Spreadsheet Editor's Ability to Run Scripts from Library

查看:67
本文介绍了Google Apps脚本-电子表格编辑器可以从库中运行脚本的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将为100所不同的学校维护Google电子表格.每所学校的电子表格都将具有类似的功能(例如,根据日期跳至某个单元格或根据输入的文本在某个单元格中创建笔记),并且多个人(例如校长,老师,教练,等等).我想为此目的创建一个库是最简单的,因为每个电子表格的功能都相同!例如,每个文档的脚本文件都使用onOpen()事件来调用.addMenu().然后.addMenu调用包装函数,此函数在我的库中调用"jumpToToday"方法. (我看到了有关如何无法直接从菜单中调用库方法的文章,这就是为什么我这样做的原因).我有两个问题:

I will be maintaining Google spreadsheets for 100 different schools. Each school's spreadsheet will have similar functions (e.g., jumping to a certain cell based on the date or creating a note in a certain cell based on inputted text) and multiple people will have access to edit it (e.g., principal, teachers, coaches, etc). I imagine that creating a library is easiest for this purpose since the functions are the same for each spreadsheet! For example, the script file for each document uses the onOpen() event to call .addMenu(). Then .addMenu calls a wrapper function and this function calls the "jumpToToday" method in my library. (I saw the posts about how the library method cannot be called directly from the menu, so that is why I did it this way). I have two questions:

1)当我(所有者)与编辑者共享电子表格时,将显示菜单,但是当编辑者选择菜单选项之一时,脚本将返回错误:您无权访问库ExternalSupport,由您的脚本使用,或者已被删除."看到此信息后,我与电子表格编辑器共享了库文件(可以查看),然后它开始工作了. 我是否必须与电子表格的所有编辑者共享该库(仅查看),以便他们可以运行这些功能?如果这样,那很好(我只是想避免使用它,因为大多数校长/老师/coach不是技术人员,所以我不想通过共享代码文件来混淆他们……我只希望他们使用电子表格).

1) When I (the owner) share the spreadsheet with an editor, the menu shows up, but when the editor selects one of the menu options, the script returns the error: "You do not have access to library ExternalSupport, used by your script, or it has been deleted." After I saw this, I shared the library file (Can View) with the spreadsheet editor and then it worked. Do I have to share the library (view only) with ALL editors of the spreadsheet so that they can run the functions? If so, that's fine (I was just trying to avoid it because most principals/teachers/coaches are not techie, so I didn't want to confuse them by sharing a file of code...I just want them to use the spreadsheet).

2)因为电子表格的编辑者只能查看该库,所以他们似乎只能访问所选的Version(即使处于dev模式下). 当我将库更新为另一个版本时,是否必须进入所有100个电子表格的脚本编辑器,然后转到资源">管理库"并更新版本?还是有一种方法可以使所有文件使用该库的最新版本?

2) Because the editors of the spreadsheet will only be able to view the library, it seems like they only have access to the Version that is selected (even if dev mode is on). When I update my library to another version, do I have to go into the Script Editor of all 100 spreadsheets and then go to Resources > Manage Libraries and update the version? Or is there a way to make all files use the latest version of the library?

推荐答案

1).根据文档

您必须为所有潜在用户至少授予对您的项目的读取级别访问权限.

you must grant at least a read-level access to your project for all potential users.

我同意这可能会使其他用户感到困惑,但是目前有必要.

I agree that this may be confusing for other users but at the moment it is necessary.

2)无法使文件使用最新版本的库.但是,有一种方法可以使文件使用库的开发版本.为此,您需要向用户授予对库的编辑级访问权限.但是,请记住,您对库所做的任何更改都将立即在用户端反映出来.您可以在文档中找到更多信息.

2) There is no way to make a file use the latest version of a library. Though, there is a way to make a file use the development version of a library. For this to work you need to grant editor-level access to your library to the user. However, bear in mind that any changes that you make to the library will be reflected immediately at the user's end. You can find more information in the documentation.

这篇关于Google Apps脚本-电子表格编辑器可以从库中运行脚本的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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