0

I have started to develop small tools for my company in the Google Spreadsheets using Google Apps Scripts, and one thing leading to another, the tool being so efficient, they are now used by a lot of people. So, in order to let the tools available while I'm working on it, I made a kind of development environment:

  • I have a copy of all my google spreadsheets in a "dev folder",
  • I make all my updates in the scripts of these dev files,
  • I test and validate all my updates
  • Then, very boring, I copy by hand all my script in the .gs files in the "prod" google spreadsheets (the one used by my colleagues), editing all the references to the file IDs of the dev spreadsheets with the file IDs of the prod spreadsheet....

So I wonder if there is an existing system to manage dev/prod environments and the appropriate deployment tool for Google spreadsheets using Google Apps Scripts.

Rubén
  • 34,714
  • 9
  • 70
  • 166
Thomas Perrin
  • 675
  • 1
  • 8
  • 24

2 Answers2

1

The best way is to use the on-board google deployment. When in the script editor, you can go to 'Publish', then 'publish as add-on'. Click this, it will lead you to a versioner. Get through this and it will lead you to the google developer deployment site.

Here you will have to pay a whopping $5 fee to permanently allow your account to deploy web apps, add-ons, etc. If your company has a google company email (that is to say example@yourCompany.com, but it's a gmail), you can deploy it to everyone in this domain.

Otherwise, you can use the little known Google Groups. If you make a Google group you can deploy it just to members of that Group.

Lastly, you can deploy it to the google app store, which makes it available to everyone. (Although, if you want to publish to the web store, it will be reviewed by Google before being allowed to go live).

I hope this helps.

EvSunWoodard
  • 1,270
  • 1
  • 10
  • 28
  • So I had a look on the publish add-ons thing, but I'm not sure it is ok for what I need: the users don't have their own spreadsheets but it is actualy 3 spreadsheets shared to all users (5 people) that they access in the "shared with me" folder, so I have in my scripts a call to the different spreadsheets by their Id, I use SpreadsheetApp.openById(). – Thomas Perrin Jul 18 '16 at 09:27
  • So I don't see how I can publish the scripts as add-on without working on the prod file script containing the prod file ID. – Thomas Perrin Jul 18 '16 at 09:44
  • 1
    Ah, I didn't get that from your question. You seem to be in a rather unique use case. What I would actually suggest is to split up your script page and your use pages. That is to say, copy and paste the actual spreadsheet data into three different pages than you are scripting for. Then publish your script. All your co workers download the script, they can now use it in the shared files. You have to copy the data to separate files or else the natural .gs will override the downloaded add-on. – EvSunWoodard Jul 18 '16 at 13:21
1

Instead of copying by hand all the changes done in the "dev" environment you might use the Google Apps Script API directly or through tools like CLASP, Google Apps Script GitHub Assistant Chrome extension.

  • CLASP is command-line tool from Google. It even is helpful to get the code from a specific version.
  • Google Apps Script GitHub Assistant Chrome extension is third-party tool that has being available for a while. Despite it uses "GitHub" it could pull / push code from several online git repositories.

Both tools work with bounded scripts.

Related

Rubén
  • 34,714
  • 9
  • 70
  • 166
  • I used to backup and deploy with GAS (Google Apps Script GitHub Assistant Chrome extension), but it seems it doesn't work anymore (not on anyone of my projects, without any change in theses projects). I tried to revoke and re-add the google apps script token in github settings but it didn't fix it. Did it still work on your side? – Thomas Perrin Mar 30 '22 at 13:48