I am new to developing Google Sheets scripts. I have code forked from krlaframboise/SmartThings and would like to make some additions and commit those to my Github fork. I can obviously edit in the sheet script editor and paste those back to my git repository but that doesn't seem ideal. What are some good patterns for developing Google Sheets scripts and tracking in Github?
-
Fork the repository, clone the fork to your machine, make your changes, commit, push - done. This isn't specific to Google Sheets at all; I'd recommend researching how to use Git and Github as these are all the very basics. Cheers, good luck! – TJ Biddle Dec 19 '17 at 20:29
-
3Thank you. What I was looking for was a way to integrate the browser-based IDE for sheets and Git. I use Git all the time. – Cord Dec 19 '17 at 20:32
-
Possible duplicate of [Should Google App Scripts be stored in version control like GitHub](https://stackoverflow.com/questions/12712593/should-google-app-scripts-be-stored-in-version-control-like-github) – Kos Dec 19 '17 at 22:11
3 Answers
Best solution I've found is GAS Github Assistant.
It's a Chrome Extension that integrates with the Apps Script IDE and allows you to pull/push code from/to your repos at the click of a button.
It not only supports Github but Bitbucket as well.
UPDATE 1/30/2018
Apps Script now has a command-line interface called clasp that offers similar functionality.

- 485
- 1
- 4
- 18

- 8,408
- 2
- 20
- 30
-
2I've started to use and works like a charm. Has all the basics I need including supporting 2FA and branches. – Cord Dec 19 '17 at 23:22
If your changes are data changes that should correspond to code changes then you should follow the pattern that good database administrators have use for years.
Make the updates with code as an upgrade script checked into source. You should also make a downgrade script that undoes the changes and check it in.
If making the changes programmatically is a headache, then make the two files simply contain instructions on how to make the data changes. Include an upgrade and downgrade instruction file with each major release.

- 6,051
- 2
- 40
- 48
I wrote a tool to pull and push google-apps-script code from/to from Google Drive. It avoids having to copy paste code.
Your use case would be as simple as this:
$ gas pull && git commit -m 'Some changes I made'

- 101
- 3