Michael SM
Michael SM

Reputation: 715

Google Apps Script - how to update scripts attached to many spreadsheets?

I wrote a script for a spreadsheet template. My user makes copies from the spreadsheet template and the attached script. There are many such instances both spreadsheet and the script. When I update the script for the spreadsheet template, I(or my user) have to manually update all scripts attached to spreadsheets. All scripts are the same. Is there a way to synchronize the script update automatically?

Upvotes: 0

Views: 167

Answers (1)

Srik
Srik

Reputation: 7957

What you can do is maintain a single standalone script and publish it as a library instead of having it reside in the spreadsheet template. This way, you have to change the script in only one place. To work with triggers such as onOpen, onEdit etc. you can have shell functions in your spreadsheet template. Something like

function onOpen(e){
  LibraryName.onOpen(e);
}

Upvotes: 1

Related Questions