I have several dozen Google Sheets that I manage for my company that all use the same Apps Scripts library and I am trying to find the easiest way to be able to update the library and have the changes propagated to the Google Sheets. I understand the use Development mode so that the Google Sheets using the library have the most up-to-date code however that requires giving edit privileges of the Apps Scripts project to the Google Sheets users.
The alternative is to turn Development Mode off so that users would only require read privileges however, to then update the code used by the Google Sheets, I would need to save a new version of the Apps Scripts library and then manually update every Google Sheet with the new library version.
Is there anyway to update the library version used by a Google Sheet using one of the Google APIs or some other way that could be done programmatically?
Sorry for answering after 1 year, If i understand, you have a Script Project which is a library for several users project and your problem is to deploy a livrary version in every client project.
As Alan Wells says, you just have to replace the manifest of each client project.
Your manifest is a appsscript.json file. (you could show/hide the manifest file in a project)
Manifest file syntax :
{
"timeZone": "XXX",
"dependencies": {
**** SOME dependencies you need for the client****
,
"libraries": [{
"userSymbol": "MAIN_SCRIPT_NAME",
"libraryId": "MAIN_SCRIPT_ID",
"version": "MAIN_SCRIPT_VERSION"
}]
},
"exceptionLogging": "STACKDRIVER"
}
You could use CLASP to manage your script easily.
In your example, in clasp, you create a master folder for your project and a subfolder for every Clients Script. You need to sync every subfolder to his GoogleAppsScript. The initialisation could be long and boring, but with a little shell you be able to push the manifest to every client script with on click/script..
You just have to modify the manifest into your Master Folder and run a script like :
for x in `ls -d SubFolder*`; do (cp appsscript.json $x ; cd $x; clasp push -f >/dev/null ; cd ..; echo "Update done on "$x) ; done
Now you can update the manifest for every client, Library version is available, but the dependencies too... (if you need start some new, or end others)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With