Managing Libraries with Google Apps Script

At last we can now create a library of useful stuff in GAS and access it (or share it) from other sheets. Those of you that have seen this blog or follow the parent web site, may have seen some of the Google Apps Script from Excel migration projects and the associated code.

Using this new library management capability in GAS, I can now make all this code available across future projects and to anyone else who want to use it just by referencing the projects key (my shared libraries can be accessed using key MEQ3tE5y5_cTOAgUbUKSIAiz3TLx7pV4j). If you are sharing your code, remember to set up the containing documents level of sharing (private, public with everyone etc)

How to create a library that can be shared
Go to the manage versions menu item of the file menu in the script editor

Save a version of your library

Take a note of the projects Key from the File/Project Properties dialog


How to Use a shared library
Create a new document that is going to access this library, and bring up the Manage Libraries dialog in the script editor.

Add a reference to the shared library. You’ll see whichever versions are available. If you leave development mode off, then your usage will be frozen to the version you select. You can change the Identifier to something else if you like. Its purpose is to nominate the namespace you will use to reference the shared functions. In this library shown all calls will be prefixed with the Mcpher namespace identifier – for example Mcpher.isEmpty().

Look at the documentation
If the library has been commented using jsDoc, then usage documentation will have been automatically generated and is accessible by clicking on the Title link for each included library. jsDoc also enables autocomplete when you call up the functions in the code you write using the library.

Use the library


I’ll be adding to this library over time – it will eventually contain all the GAS code referred to on the ramblings site, and I’ll also be improving the jsDocumentation available for the shared libraries. Please contact me at the ramblings forum if you have any questions.

Project Key :


Source code:

About brucemcp 225 Articles
I am a Google Developer Expert and decided to investigate Google Apps Script in my spare time. The more I investigated the more content I created so this site is extremely rich. Now, in 2019, a lot of things have disappeared or don’t work anymore due to Google having retired some stuff. I am however leaving things as is and where I came across some deprecated stuff, I have indicated it. I decided to write a book about it and to also create videos to teach developers who want to learn Google Apps Script. If you find the material contained in this site useful, you can support me by buying my books and or videos.