如何在少量文档之间共享一个Google Apps脚本? [英] How to share one Google Apps script between few documents?

查看:75
本文介绍了如何在少量文档之间共享一个Google Apps脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为文档部分编号编写了简短的脚本。但每当我想在新文档中使用它时,我都必须创建它的新副本。我尝试通过选项部署为Web应用程序...发布脚本,但尚不清楚如何在新文档中连接它。可能吗?我在Google云端硬盘中有几个文档,每个文档都有相同脚本的副本。我可以将每个文档连接到一个脚本吗?非常感谢!

I wrote short script for numbering of document sections. But every time when I want to use it in new document I must create new copy of that. I tryed to publish the script by option "Deploy as web app..." but it is not clear how to connect it in new document. Is it possible? I have few documents in Google Drive and few copies of same script for each of document. Can I connect every document to one script? Thanks a lot!

推荐答案

我有类似的问题。
我能够想象的更精简的解决方案是将函数保存在一个完整的共享脚本文件中。在电子表格脚本中,您将使用共享脚本文件作为库。

I had a similar problem. The leaner solution that I was able to imagine is to keep the function in a saparate, shared script file. In the spreadsheet script, you will use the shared script file as a library.

通过这种方式,您的逻辑保留在单个副本中,逻辑的实际部分被复制几次只是对共享函数的调用。

In this way, your logic remains in a single copy, the actual part of the logic that is copied several time is only a call to a shared function.

这篇关于如何在少量文档之间共享一个Google Apps脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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