How to share one Google Apps script between few do

2019-08-31 07:22发布

问题:

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!

回答1:

This is not possible for now, there is an open enhancement request that you could star to mark your interest and be informed if something new comes up...



回答2:

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.