Let’s be honest. Your digital life is a mess. Your inbox is a warzone, your calendar looks like a game of Tetris played by a squirrel on espresso, and your Google Drive is a digital graveyard where files go to be forgotten. You dream of a world where things just… organize themselves.
What if I told you that with the advent of AI, you can McGyver your way to harness your Google Workspace (Drive, Gmail etc) using a forgotten feature. It’s called Google Apps Script, and you’re now learn how to cast it’s spell with just natural language.
What in the World is Apps Script?
It’s a simple scripting language (basically JavaScript with a Google-flavored twist) that lives in the cloud and can control your Gmail, Calendar, Docs, Sheets, and more. It’s the key to making your apps talk to each other and do your bidding while you’re off doing more important things, like debating whether a hot dog is a sandwich.
With Apps Script, you can:
- Gmail: Automatically find all emails with “urgent” in the subject, given them to Gemini and label the them “Probably Not,” and archive them.
- Calendar: Create a script that seeks out any meeting invite with the word “synergy” and declines it with a randomized, poetic excuse.
- Sheets: Write a custom function that pulls the current price of Bitcoin and tells you how many pizzas you could have bought in 2010 with the same money.
- Docs: Generate a weekly report by pulling data from three different Sheets, formatting it into a beautiful document, and emailing it to your boss, making it look like you worked all weekend.
If you want a crash course in it, see this 5-minute quickstart.
Gearing Up: Your Vibe-Coding Toolkit
“But I’m not a coder!” you say. Doesn’t matter. We’re not going to “code.” We’re going to “vibe-code.” This means describing what we want in plain English and letting an AI do the hard work. To do this, you’ll need a few things on your Mac.
VSCode (Visual Studio Code): This is your digital workbench. It’s a free, powerful text editor where we’ll write our instructions. If you don’t have it, download it here. It’s the Leatherman of programming.
NPM (Node Package Manager): This is the tool we’ll use to install our other command-line wizards. The easiest way to get NPM is to install Node.js. Don’t worry, you don’t need to know what Node.js is. Just go to the official Node.js website, download the LTS (Long Term Support) version for macOS, and run the installer. It’s as simple as installing any other app.
Clasp and Gemini CLI: These are your magic wands.
clasp
beams your scripts from your computer up to Google’s cloud.gemini-cli
is your AI genie, a command-line tool that lets you talk to Google’s powerful Gemini models.
To install both, open your Mac’s Terminal app (you can find it using Spotlight search) and type this command, then press Enter:
npm install -g @google/clasp @google/gemini-cli
After the installation is complete, you need to log in to your Google accounts for both tools. Run these commands one by one in the Terminal:
clasp login gemini auth
Follow the instructions that pop up in your web browser to grant access.
A quick word on the genie’s rules: The free version of the Gemini API is quite generous and more than enough for the kind of vibe-coding we’re doing. You get plenty of free wishes (a.k.a. quota) per day. If you ever decide you want to automate your entire company, you can look into the paid plans.
Let’s Cook: Your First Automation
Ready? Let’s solve a real-world problem: the plague of Google Meet recordings and transcripts that clutter up your “My Drive” folder. We’re going to build a robot that automatically finds them and files them away neatly.
The secret to vibe-coding is to separate the WHAT from the HOW.
- The Recipe (
SPEC.md
): A plain-English description of exactly what you want to happen. No code, no jargon. Just a clear set of instructions. You need one for each thing you want to do. - The Bible (
GEMINI.md
): This is the rulebook for your AI genie. It tells it how to behave. You can reuse the same one here for all your future AppScript needs.
Let’s get this set up in VSCode.
Create and Open a Project Folder: First, create a new folder somewhere on your computer (e.g., in your
Documents
folder) and name itmeet-organizer
. Now, open VSCode, go to theFile
menu, and selectOpen Folder...
. Navigate to your newmeet-organizer
folder and open it. You’ll see the folder name in the “Explorer” panel on the left. This is your workspace.Create Your Instruction Files: In the VSCode Explorer panel, right-click in the empty space below the
meet-organizer
folder name and selectNew File...
. Name the first fileSPEC.md
and press Enter. Repeat the process to create a second file namedGEMINI.md
. You should now have two empty files ready for your instructions.
Now, copy and paste the content below into your newly created files.
The “Recipe”: SPEC.md
This file describes our goal.
Script to periodically move Gemini Meet transcripts and recordings attached to a calendar event to a destination directory.
Functionality:
* Crawl my calendar events from past N days and search for events with transcripts and/or recordings that have `AUTO_MOVE_MEET_RECORDING_AND_TRANSCRIPTS` in their description.
* Look for line `AUTO_MOVE_MEET_RECORDING_AND_TRANSCRIPTS: <url_to_drive_dir>` in description for the destination drive folder.
* Out of the attachments to the event, look for the recording/transcript and move them to the directory
* Rename the moved files with `<date> - <meeting_title> - <Recording|Transcript>` in the destination directory.
* For a handled event replace the line `AUTO_MOVE_MEET_RECORDING_AND_TRANSCRIPTS: <url_to_drive_dir>` with `AUTO_MOVE_DONE` in the description.
* Have a dry run option and way to set it up to process things every day at midnight.
The “Bible”: GEMINI.md
This file tells our AI how to write the code. It’s our “style guide.”
Project:
* This project is intended to run in Google AppScript environment on Google Workspace objects of the given user.
* Use [clasp](https://github.com/google/clasp) for uploading/changing changing code and as many user interactions as possible. Set up a `.clasp.json` and keep it in sync.
* Set up `appsscript.json` for `oauthScopes` needed and other project needs. Keep it in sync with changes.
* Whenever set up or non-code configuration is required, update README.md to tell the user. Insert the instructions in a way that makes set up from scratch possible. Document first how to perform Dry-Runs for users to validate the correctness of the program. Only then document permament setups later.
Code:
* This is a Google AppScript `*.gs` project. NOT JS. Make sure you use the AppScript subset of syntax, but do name files `*gs.js`.
* When uncertain, search for APIs, capabilities and syntax *primarily* at https://developers.google.com/apps-script/ rather than relying on JS knowledge.
* In Google Appscript all functions are automatically included in all files. IMPORTANT: * DO NOT* generate functions that are already in other files.
* When there's a comment `GEMINI NOTE` in the surrounding text, obey that.
* Write good quality code:
* use forEach and subfunctions instead of endless nested for-loops
* use return values in subfunctions, and exceptions as means of propagating errors to outer functions
* add Log statements to make it easy to understand what's going on but mostly in outer functions
Strategy/Planning:
* Plan before doing, but think *BRIEFLY* for planning. This is AppScript, *not* rocket science. The user will be giving you relatively simple changes to make.
* Use Google search against app-script docs if uncertain.
In general: write code for software engineers, write documentation and instructions for non-technical users.
The Magic Incantation
Now for the magic. We’ll run our command right inside VSCode.
Open the Terminal: In VSCode, go to the
Terminal
menu at the top of the screen and selectNew Terminal
. A command-line panel will appear at the bottom of the editor. It’s already in your project’s directory (meet-organizer
).Cast the Spell: Click inside the terminal panel and type the following command, then press Enter:
gemini Implement @SPEC.md while obeying @GEMINI.md .
What Happens Next?
Your AI genie will now read your files and think for a moment. Then, it will propose a series of actions, like creating new code files (.gs.js
), a README.md
with instructions, and configuration files. It will ask for your permission before it does anything. When you see the prompt asking you to Accept changes? [y/n]
, it’s asking for your consent to write those files to your project folder. Type y
and press Enter to let the magic happen.
What If It Breaks?
Sometimes, even genies make mistakes. If the code has a bug or you see an angry-looking error message after you deploy it, do not panic. This is part of the process. Simply copy the entire error message, paste it back into your chat with Gemini, and say, “Hey, this broke. Fix it.” The AI will analyze the error and give you the exact steps or code changes to make things right. Think of it less as a bug and more as a conversation.
You’ve just told your AI genie: “Here is exactly what I want to build (SPEC.md
), and here is my rulebook for how you must build it (GEMINI.md
). Now, get to work.”
This is the core of vibe-coding: you are the creative director, and the AI is your infinitely patient, slightly-less-funny-than-me assistant.
The gemini-cli
tool will now generate all the necessary files. Follow the shiny new README.md
it creates to deploy your robot. You just built a custom automation without writing a single line of code. You are officially a wizard. Now go forth and automate the boring stuff!