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.
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 :