For this year's Advent of Code (AOC) I went OTT (over-the-top) setting up my dev environment! AOC is always a good chance to learn something new.
This year I'm using Apps Script! Last year I went OTT and used Palantir!
The puzzles are small enough that you can solve them on your laptop, a browser, even mechanical devices and vibe coding!) but I want to learn about automation on Google Workspace this year as I use it everyday.
Apps Script is "a cloud-based JavaScript platform powered by Google Drive that lets you integrate with and automate tasks across Google products."
Think of it like Power Automate for M365 but you need to know JavaScript (or how to prompt!). The no-code version of Apps Script is Workspace Studio.
Apps Script projects (JavaScript code and manifest file) can be published and shared with others (like GitHub Gists). Some popular ones are:
https://github.com/googleworkspace/apps-script-oauth2/blob/main/src/OAuth2.js (Libraries -> 1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF)
This is for if you have created a Desktop Application in GCP and you need to call it in Apps Script to access specific GCP resources. It was written 11 years ago!
There is a developer community where people share some extensions they have build using Apps Script and these may land on the Market Place.
New API's are shared ahead of time to help developers e.g. this YouTube playlist is from the Workspace Developer Summit 2025.
I was happy when Google chat apps could finally use Markdown instead of HTML. I was able to kill the horrible system instructions of (here):
Instructions for formatting your response: Respond with normal text. For emphasis or structure ONLY use the following HTML tags: <b>bold</b>, <i>italic</i>, <code>inline code</code>, <pre>code block</pre>. Do NOT create a full HTML document. Absolutely do NOT include <!DOCTYPE>, <html>, <head>, or <body> tags. Just provide the formatted text answer to the prompt.
and pass through the AI response (Markdown) for an AI Google Chat application I created.
My ideal development is something local where I can iterate.
Apps Script is only accessible in a browser. This makes it more secure and simplifies OAuths. However, it still requires ClickOps instead of DevOps. It is therefore difficult to utilize a coding agent that can write code, test, write code, plan etc. It is likely a computer use model can do what I want by automatically interacting with the browser - like a self driving car for your computer. Antrophic demonstrations how their coding agent can interact with the browser and work with Google workspace files:
Before I try the computer use I want to explore dev tools around Apps Script
There is a tool called clasp which allows you to write an Apps Script project locally and run it. There is another tool called gas-fakes (Google Apps Script) which the author states "I set myself the ambition of implementing a fake version of the GAS runtime environment on Node so I could at least do some testing and debugging of Apps Scripts locally on Node."
The goal of gas-fakes is to make developing Apps Script code as simple as opening the console in a browser.
I will now dive into solving day 1 of advent of code using different frameworks but centered around Apps Script.
To solve these you should start with the small dataset and match the given solution. Once you crack this you can use your personal data and submit your solutions.
The day 1 problem is a classic circular movement problem. Your goal is to simulate the movement of a safe dial and count how many times it lands on 0 (0-99 digits on the safe dial).
You can use Modulo (remainder of division) to keep track on the safe dial positions e.g. Start and 30, turn clockwise through 100 digits and you end back at 10
console.log((30 + 100) % 100); // Output: 30