1

I need to add the same container-bound script to hundreds of google sheets in order to automate a process. I have a separate spreadsheet that catalogues the URLs of all the sheets in need of updates.

Does anyone know how to write a script that will update (and save) script within the script editor based on the sheet's URL? Currently, I'm opening each spreadsheet individually and saving script.

Rubén
  • 34,714
  • 9
  • 70
  • 166
MellyCopter
  • 51
  • 2
  • 6
  • Have you looked into Libraries? https://developers.google.com/apps-script/guide_libraries – OblongMedulla Apr 04 '17 at 15:50
  • 1
    @OblongMedulla I have looked into libraries but haven't been able to determine their use in this case. I looked at the below thread, but it looks like libraries have changed in format since 2013 and I cannot seem to get beyond inputting the project key. Any tips or updated directions? http://stackoverflow.com/questions/20643885/how-can-i-invoke-my-standalone-script-in-my-spreadsheet – MellyCopter Apr 04 '17 at 16:33
  • 2
    Even if you use a library, all of the spreadsheets that need your code will still need to be opened, and every one of those spreadsheets will need the project key added. In the "long run" you will be much better off using an Add-on that is published as unlisted. Everyone who needs to use the Add-on will need to install the Add-on. If you are in an organization that is using GSuite, then you can publish the Add-on for domain wide use. Changes to Add-on updates get propagated automatically to every document. All you need to do is publish a new version. There is no code to do what you want. – Alan Wells Apr 04 '17 at 20:10
  • Thank you, @SandyGood. I will look into this! – MellyCopter Apr 04 '17 at 21:34
  • You will need to pay a one-time $5 dollar fee to publish an Add-on. Make sure to do that before you do anything else. – Alan Wells Apr 04 '17 at 21:52
  • 1
    It's now possible to programatically change the manifest file. And there is the new API to make changes to Apps Script file. – Alan Wells Jan 28 '18 at 14:33

0 Answers0