Google Apps脚本按钮:我可以分配“全局"广告资源吗?脚本未附在工作表上吗? [英] Google apps scripts button: can I assign a "global" script that's not attached to the worksheet?

查看:46
本文介绍了Google Apps脚本按钮:我可以分配“全局"广告资源吗?脚本未附在工作表上吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本要分配给多个不同电子表格上的按钮.如果我在电子表格上创建一个按钮并引用存储在Google驱动器上另一个父文件夹中的脚本,则会收到错误找不到脚本函数myScript .我可以通过使用按钮进入每个工作表,选择 tools ,选择 Script editor ,然后将我的脚本粘贴到此处来解决此问题.问题是 myScript 依赖于其他多个脚本,因此对于一打纸,我不得不如上所述复制多个脚本,以将它们附加"到电子表格中并使其可访问.通过按钮.这是将来更新脚本的明显挑战.

I have a single script that I want to assign to a button on multiple different spreadsheets. If I create a button on the spreadsheets and reference the script, which is stored in another parent folder on Google drive, I get the error Script function myScript could not be found. I can resolve this by going into each sheet with the button, selecting tools, selecting Script editor, and then pasting my script there. The problem with this is that myScript depends on multiple other scripts, so for a dozen sheets, I'd have to copy over multiple scripts as described above to "attach" them to the spreadsheet and make them accessible via button. This is an obvious challenge for updating scripts in the future.

我有没有办法使我的一个项目具有全球可用的所有脚本,因此我不必将相同的脚本复制/粘贴到每个电子表格中?

Is there a way for me to make my one project with all the scripts globally available, so I don't have to copy/paste the same scripts to every spreadsheet?

推荐答案

您可以做的是创建一个脚本并将其用作库,这样您便可以将该库附加到您可能拥有的任何单个实例上您的工作表等.

What you can do is to create one script and use it as a library, whereby you would then proceed to attach that library to any individual instances where you would have your worksheets and so on.

这是基本概念: Google开发人员指南:库

这是我一直在做的事情.

This is what I've been doing in any case.

这篇关于Google Apps脚本按钮:我可以分配“全局"广告资源吗?脚本未附在工作表上吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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