Apps Script: Triggers, Macros & Automation

Master Google Sheets Automation

Unlock Google Sheets superpowers with Apps Script. Automate your sheets with triggers like onEdit and onOpen. Build custom menus, launch web apps, and deploy powerful code. All inside the Google Sheets you already use.

Key Apps Script Concepts

Triggers & Automation

  • Simple trigger: Functions like onEdit and onOpen that run automatically
  • Install trigger: Runs once when a user installs your script
  • Create custom menus for user interactions
  • Monitor scripts with execution log

Script Types & Configuration

  • Bound script: Attached directly to a Google Sheet
  • Use the script editor to write and debug code
  • Deploy web apps for external access
  • Configure manifest for advanced features
  • Manage scope permissions and quota limits

Become an Apps Script Pro: Explore Our Courses

Unlock the power of Google Apps Script with step-by-step, example-driven courses. All courses are included in the Better Sheets Membership, or available as a bundled masterclass on Udemy: Master Spreadsheet Automation .

Learn to Code: Google Apps Script

Start from zero! Learn the basics of coding with real-life Google Sheets problems. Master triggers like onEdit and onOpen, create custom menus, and work with bound scripts in the script editor.

  • No coding experience required
  • Step-by-step video walkthroughs
  • Learn simple triggers and install triggers
  • Monitor code with execution logs
  • Includes a collection of ready-to-copy scripts

Spreadsheet Automation 101

Essential Automation

Dive deep into automating your workflows. Ideal for freelancers, analysts, and business owners seeking to save hours and build robust automated sheets.

  • Trigger scripts on edit, with buttons, or on a schedule
  • Connect and automate Gmail, Slack, and more
  • Create custom menus & UI in Sheets
  • Downloadable templates and scripts
Outcome:

By the end, you’ll be able to automate end-to-end processes in your own business using Apps Script. You’ll have code samples, templates, and real project walkthroughs to lean on.

Advanced Apps Script & More

Deep Dives

Take your skills to the next level with courses on:

  • Building Add-ons for Google Sheets
  • API Integrations & Webhooks with Apps Script
  • Best Practices & Promoting Your Scripts
  • Security and Collaboration Tips
Outcome:

Ideal for anyone ready to publish tools, create complex automations, or lead a team in collaborative script development.

All Courses + More with Better Sheets Membership

Unlock every Apps Script and Google Sheets course, hundreds of copyable code snippets, project templates, and walkthrough videos. Get immediate access to interactive examples and community Q&A. All included in your Better Sheets monthly membership.

Join Better Sheets Membership
Prefer learning on Udemy? Get the bundled masterclass here.
Step-by-Step Guidance

Every course breaks tough topics into simple lessons. Follow along directly inside your own Google Sheets.

Real Projects & Resources

Download all code, sample spreadsheets, and ready-to-use templates for your own projects.

From Beginner to Advanced

Whether just starting or building add-ons, you’ll always find courses, tools, and solutions for your level and goals.

Top YouTube Videos & Playlists for Google Apps Script

Level up faster with hand-picked video tutorials and deep dives. Much of it is free on YouTube, or unlock even more in the Better Sheets members area.

Spreadsheet Automation Fundamentals Playlist
Playlist

Spreadsheet Automation Fundamentals

From foundational skills to essential Apps Script concepts, this playlist takes you step-by-step through automating Google Sheets even if you’re brand new.

  • Get hands-on with triggers, custom functions, and real automations.
  • Perfect for beginners & practical for busy professionals.
Watch Playlist on YouTube
AI in 2 Minutes
Quick Guide

AI in 2 Minutes

Instantly use AI in your Google Sheets with Apps Script. No prior coding required. Learn how to connect and automate AI use-cases in a flash.

  • Supercharge sheets with AI in just 2 minutes.
  • Beginner-friendly, great for rapid prototypes.
Watch on YouTube
Google Sheets for Coders
For Programmers

Google Sheets for Coders

Dive deep into Apps Script for developers and power users. Explore advanced patterns, sheet coding tips, and “dev-mode” productivity boosters.

  • Write scalable, maintainable code in Sheets.
  • Explore APIs, linting, and pro code workflows.
Watch on YouTube
Create a REST API in Sheets
Advanced Project

Build a REST API in Google Sheets

Take spreadsheet automation to the backend: build, deploy, and secure a REST API entirely within Google Sheets using Apps Script.

  • Real coding example: Endpoints, authentication, and use cases.
  • Great for SaaS prototypes & internal tooling.
Watch on YouTube

Want More In-Depth Tutorials?

Unlock exclusive step-by-step Apps Script projects, coding Q&A, and full video courses in the Better Sheets Members Area.

Explore Membership

Featured Code Snippets

Send Email to Kindle via Google Sheets

Using Apps Script here is the code to send from gmail to Kindle. You can use a trigger to automate this daily or weekly.

Generate Random ID Length

Generate random codes for IDs or other purposes. Any number of characters. Check out this video where it's used: https://www.youtube.com/watch?v=VQsV52LTU7Y

Create Chat Space

Create a chat space from apps script. Very cool to do so you can Assign Tasks to people in that chat space.

Get YouTube Subscriber Count from YouTube Channel Url

Use this code to turn youtube urls with handles into subscriber counts. Make sure before you use the code that you do the steps including Activate YouTube API in services, add GCP number, create oAuth Consent Screen, Enable YouTube API, and Create your own API key.

Make Spreadsheet Private

Useful to use this script if you want to privatize your sheet at some specific time

When Urgent, Move to Top of Google Sheet

This Google Apps Script function, onEdit(e), automatically moves rows to the top of "Sheet1" when a specific condition is met. Here's how it works: It detects when a user edits a cell in the sheet. If the edited cell is in column 3 (C), the row is greater than 1, the new value is "Urgent", and the sheet name is "Sheet1", the function triggers. It extracts the row's data from columns A to E. A new row is inserted at the second row (just below the headers). The extracted data is copied into this new row. The original row is deleted, ensuring that urgent tasks always appear at the top. This script is useful for prioritizing urgent tasks dynamically in a Google Sheet.

Custom Menu - 1 Function

One menu function

Dall-e-3 API Call

Create an image from Google Sheets with OpenAI's Dall-e

Duplicate Template

Create a copy of the template. You can trigger this every day or every month, or every week.

Create Tab For Every Day of the Year

Creates a new tab for every day of the year.

Upgrade Your Apps Script Skills 🚀

Join Better Sheets Membership and
unlock exclusive tutorials, deep-dive videos, and real-world automation examples.
Automate your workflow and master Google Apps Script.

Get Instant Access →

Become a member today. Power up your Sheets, Code & Career.

Apps Script Glossary: Key Terms Explained

Triggers

Simple Trigger
Functions like onEdit and onOpen that run automatically when specific events occur in your Google Sheet.
Install Trigger
Runs once when a user installs your script, perfect for initial setup tasks.
onEdit Trigger
A simple trigger that fires automatically when cells are edited in your spreadsheet.
onOpen Trigger
A simple trigger that runs when a user opens your Google Sheet.

Script Types & Tools

Bound Script
A script attached directly to a Google Sheet, accessible through the script editor.
Script Editor
The built-in IDE where you write, edit, and debug your Apps Script code.
Web App
A deployed Apps Script that can be accessed via URL, allowing external systems to interact with your script.
Custom Menu
A user-created menu in Google Sheets that triggers custom functions, typically added via onOpen.

Configuration & Limits

Manifest
A configuration file (appsscript.json) that defines your script's properties, including scope permissions.
Scope
The permissions your script requests to access Google services (Sheets, Drive, Gmail, etc.).
Quota
Daily execution limits for Apps Script, including runtime duration and API call limits.
Execution Log
A debugging tool in the script editor that shows when scripts ran, errors, and execution details.

Macros

Macro
Recorded actions in Google Sheets that can be replayed. While different from Apps Script, macros can be converted to Apps Script code for more advanced automation.