Creating a Google Apps Script Library

mcpher Library

All Google apps script library code is in the mcpher library. If you already know about google sctipt libraries you can get it as below, and read about it in this post.

Project Key :

Source code:


Managing a Script library

When Google Apps Script first came out it was rather tedious (and kind of ridiculous for a cloud based environment) having to copy shared code between projects. Things soon got out of hand and you didn’t know what version was what.

However, At last we can now create a library of useful stuff in GAS and access it (or share it) from other sheets. 

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 From VBA to Google Apps Script code, 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:

Take a look at how the From VBA to Google Apps Script for more like this, as well as the Roadmap Generation. In the meantime why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available.