How to run versions for a Google Sheet

852 views
Skip to first unread message

Stephen Schlager

unread,
Jun 9, 2022, 1:59:28 PM6/9/22
to Google Apps Script Community
Hello,

I have found many resources for running versions and Managing deployments, but they all seem to relate to Web Apps with doGet or doPost etc. or libraries...

I have apps script code that runs for a spreadsheet (modifies the spreadsheet, sends emails, etc.)
I have tried playing with deployments but it always runs from the HEAD, is there a way to version control this type of Google Spreadsheet script?

I'd like the user to be able to go to the spreadsheet and when they click on the menu button I created it will run whichever version I've "deployed".

Does that make sense?

Also is there a way to version control code bases, so I could jump to a previous version in my Apps Script console and see the code from that version?

Thank you,

Steve

Andrew Roberts

unread,
Jun 9, 2022, 2:25:59 PM6/9/22
to google-apps-sc...@googlegroups.com
> I'd like the user to be able to go to the spreadsheet and when they click on the menu button I created it will run whichever version I've "deployed".

I don't think you can do this without using libraries. Put your main code into a library, and a minimal bound script on the GSheet that uses the version of the library that you have "deployed".

> Also is there a way to version control code bases, so I could jump to a previous version in my Apps Script console and see the code from that version?

Not natively. The GasHub chrome extension lets you use GitHub to manage the version you want in a particular script project.


--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/3f1a36f8-3d12-4378-9a1f-39d4b436392an%40googlegroups.com.

Stephen Schlager

unread,
Jun 10, 2022, 7:24:31 PM6/10/22
to Google Apps Script Community
Thank you for the ideas...I thought it would be a kind of work around. Seems like something they should integrate at some point.

I appreciate you sharing your workflow!

Have a great weekend!

Martin Hawksey

unread,
Jun 13, 2022, 4:22:09 AM6/13/22
to Google Apps Script Community
It is possible to programmatically update apps script code by calling the Apps Script REST API. An outline of this approach is provided here https://stackoverflow.com/a/65560046/1027723

Rather than the user 'pulling' the deployed version by clicking a button you might find it better to 'push' code so that can can ensure the user is using the correct version of your script. You would do this by maintaining a list of script project ids then pushing code as needed.

If you want to take this one step further there are come nice workflows possible using GitHub https://pulse.appsscript.info/p/2022/06/how-to-automate-google-apps-script-deployments-with-github-actions/ (GitHub provides private repos on free accounts)

Bruce Mcpherson

unread,
Jun 13, 2022, 5:44:15 AM6/13/22
to google-apps-sc...@googlegroups.com

Stephen Schlager

unread,
Jun 13, 2022, 11:07:43 PM6/13/22
to Google Apps Script Community
Appreciate the ideas guys.
Google's platform makes development so easy...if they integrated something like that, it would be amazing!

For now, thanks for the ideas.

Steve

Emerson Maia

unread,
Jun 14, 2022, 9:11:27 PM6/14/22
to google-apps-sc...@googlegroups.com

Good night I think the best option and you will create a library in them will have the updates.

Витя Коледа

unread,
Jun 20, 2022, 8:32:07 AM6/20/22
to google-apps-sc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages