2

I copied a spreadsheet to be used by multiple people with script attached. My question is how do I modify script in the project without having to copy and paste each change to .gs files in the project?

This is the base document from which the other versions were copied: enter image description here

Majid Hajibaba
  • 3,105
  • 6
  • 23
  • 55

2 Answers2

1

Create a central script and then publish it as a library. Have your template linked to the library. Make sure that the template is using the "dev" version of the library so that any future changes will be reflected for everyone.

There ARE ways to manipulate the GS files using clasp but it is much less straightforward than using libraries and overkill for this use case.

https://developers.google.com/apps-script/guides/libraries

J. G.
  • 1,922
  • 1
  • 11
  • 21
1

Yes, it's possible to "upload" a .gs file to an existing Google Apps Script project. To do this you might use CLASP, GAS GitHub Assistant (a Chrome extension) or directly the Google Apps Script API.

Please bear in mind that you also could alleviate these pains (having to update the bounded to spreadsheet GAS project copies) by taking a different approach. You could use libraries or to create a Workspace Editor add-on.

Libraries help by keeping a big part of your code in a single place but you might still have to update the copies i.e. if you are using simple triggers like onOpen and onEdit or if you change library function name, add a new function, etc.

Add-ons help by keeping all the code in a single place bu you have to publish the add-on to the Google Workspace Marketplace. If you have a Google Workspace account the add-on can be published for internal use.

Rubén
  • 34,714
  • 9
  • 70
  • 166
  • Thanks for your help, but I get this message after attempting look up the library. I created a deployment library version from the source project and pasted the ID here. – NeophyteLou Aug 23 '21 at 17:02
  • Unable to look up library. Check the ID and access permissions and try again. – NeophyteLou Aug 23 '21 at 17:04
  • You are welcome @NeophyteLou . Follow-up questions should be posted as new questions. – Rubén Aug 23 '21 at 17:05
  • P.S. Libraries should be shared with the owners/editors of the spreadsheets having a bounded script that use them. – Rubén Aug 23 '21 at 17:07