How to make set of scripts available for all my Go

2020-02-29 18:01发布

Excel supports the concept of a PERSONAL.XLS file which contains my personal scripts, which I want to be able to use on any spreadsheet/workbook that I open.

How do I do similar in Google Docs, i.e. have a set of scripts which, regardless of which Google Spreadsheet I open, will cause the onOpen event to be run and will thus add my extra menu?

3条回答
SAY GOODBYE
2楼-- · 2020-02-29 18:45

Although not recommended, You can also copy set of scripts to all other google spreadsheets programmatically using AppsScriptApi

查看更多
\"骚年 ilove
3楼-- · 2020-02-29 18:50

1) You can open your Script and from the Publish menu select "Test as add-on".

2) Now under "Configure New Test" you can select a document and then run the add-on for that doc.

Unfortunately you have to do this for each document one at a time. I would really love it if there was a way to tell a script to be available for all my spreadsheets, or at least have an easy way to install a personal add-on on a per-sheet basis just like you can install an add-on from the marketplace, kinda like a personal marketplace.

查看更多
我命由我不由天
4楼-- · 2020-02-29 19:03

You cannot do that in Google Spreadsheets. However the best practice is to

  1. Write a standalone script with your onOpen and other functions.
  2. Publish this as a library
  3. Write a shell onOpen in each of the spreadsheets that you create manually. :( This shell function will call the library's onOpen.

However, if you create a copy of a spreadsheet that has an associated script, then the copy will also have the script in it.

查看更多
登录 后发表回答