Skip to content

Apps Script book

Comprehensive Apps Script

Learn Google Apps Script through small examples: build a maintainable Sheets request tracker, chapter by chapter, from first script to deployment.

38 chapters 8 parts Practical, self-paced

Start here

Build from a first function to a maintainable workflow.

Each chapter keeps setup, expected results, and source files beside the explanation.

Read chapter 1

Contents

The learning path

  1. Part 1

    Getting started

    1. 01 Orientation Choose between bound and standalone Google Apps Script projects and understand the boundary between V8 code, Workspace services, and user data.
    2. 02 Run your first Sheets script Run your first bound Apps Script: read a small Customers sheet tab into the execution log and inspect the logged two-dimensional array.
  2. Part 2

    JavaScript and the runtime

    1. 03 Work with JavaScript values and objects Update an in-memory Apps Script request while keeping text, numbers, booleans, and missing values distinct without hidden type conversion.
    2. 04 Make decisions with functions and loops Write reusable JavaScript functions in Google Apps Script using parameters, return values, conditional branches, and a bounded iteration loop.
    3. 05 Work with JavaScript arrays Work with 2D arrays from Range.getValues() in Google Apps Script, map header names to column indexes, and filter active rows without mutating data.
    4. 06 Understand the runtime and permissions Separate JavaScript execution, project context, Apps Script services, manifest configuration, authorization scopes, and execution identity.
  3. Part 3

    Reliable automations

    1. 07 Read and write Sheets in batches Use Range.getValues() and setValues() in Google Apps Script to update a request table in one batch read and write after checking the 2D array shape.
    2. 08 Write custom functions for Sheets formulas Write Apps Script custom functions that Sheets formulas call, accept a cell or a range, fill cells with a 2D array, and stay inside their limits.
    3. 09 Validate, highlight, and react to Sheets edits Add dropdowns, checkboxes, and conditional formatting to Google Sheets in Apps Script, and stamp status edits with onEdit(e) without clobbering rules.
    4. 10 Fetch data from web APIs Use UrlFetchApp.fetch() in Google Apps Script to import JSON from a web API into a Google Sheet range and handle paginated HTTP responses and retries.
    5. 11 State across runs with PropertiesService Store state across Apps Script runs with PropertiesService, CacheService, and LockService for durable script properties, per-user keys, and caches.
    6. 12 Install time-driven triggers safely Install and remove repeat-safe time-driven triggers for a bound Apps Script request tracker, without creating duplicate clock triggers.
    7. 13 Build a safe Sheets request tracker Combine a validated Google Sheets request table, a repeat-safe SpreadsheetApp batch update, and a removable ScriptApp time trigger in one project.
  4. Part 4

    Workspace services

    1. 14 DriveApp files, folders, and scopes Copy Google Drive files by ID with DriveApp, or pair Google Picker and the drive.file scope with the advanced Drive service for single-file access.
    2. 15 Generate a Docs report from a template Use DocumentApp and DriveApp in Google Apps Script to copy a Doc template, replace placeholders with replaceText(), build tables, and record links.
    3. 16 Prepare Gmail work before sending Use GmailApp in Google Apps Script to search test threads, create plain-text or HTML drafts with createDraft(), and track per-message delivery state.
    4. 17 Maintain Calendar events by identity Use CalendarApp in Google Apps Script to create events on a selected calendar, handle time zones with Utilities.formatDate, and update by event ID.
    5. 18 Google Forms scripts and response triggers Build a Google Form in Apps Script with FormApp, add branching and quiz items, and handle form-submit trigger responses without duplicate work.
    6. 19 Build a two-slide garden briefing Use SlidesApp in Google Apps Script to create a Google Slides presentation once, place text, shapes, lines, and PNG images, and update by ID.
    7. 20 Inspect a folder with Advanced Drive v3 Enable the Advanced Drive service in Google Apps Script and call Drive.Files.list with pageToken to inspect metadata from a selected Drive folder.
  5. Part 5

    User interfaces

    1. 21 Menus, sidebars, and modals Use onOpen(), SpreadsheetApp.getUi().createMenu(), and HtmlService in Google Apps Script to open custom menus, sidebars, and modal dialogs in Sheets.
    2. 22 Build a private request-status web app Connect an HTML form to an Apps Script lookup with server validation, safe browser rendering, and private deployment permissions.
    3. 23 HTTP endpoints and webhooks with doPost Handle HTTP requests and webhooks in Apps Script with doGet and doPost, test redirected web-app URLs, and verify HMAC-signed JSON payloads.
    4. 24 Build a personal Workspace add-on Put a useful checklist in the Drive side panel with CardService, validated actions, and per-user saved state without reading Drive files.
    5. 25 Install and release a Workspace add-on Continue the Drive checklist through development installation, versioned release rehearsal, Marketplace configuration, and OAuth verification preparation.
  6. Part 6

    Development and operations

    1. 26 Use the myFunction editor extension Install the myFunction Chrome extension, review what it can access, and use its diagnostics, navigation, and formatting on a small Sheets project.
    2. 27 Debug executions and recover from limits Debug Google Apps Script with Logger.log, console.log, and execution history, stay inside the 6-minute run limit, and recover failed runs cleanly.
    3. 28 Local Apps Script development with clasp Develop Google Apps Script locally with clasp (@google/clasp) and Git to clone a bound project, inspect upload files, and push verified revisions.
    4. 29 Test Apps Script code locally and in Sheets Extract pure helpers from Apps Script services, run fast local unit tests with Node's test runner, and verify Sheets integration in a disposable test tab.
    5. 30 TypeScript for Google Apps Script Write and compile TypeScript for Google Apps Script with @types/google-apps-script and clasp, configure tsconfig.json, emit .gs code, and upload.
    6. 31 Share a versioned Apps Script library Build a reusable Google Apps Script library project, attach it by Script ID at a pinned version, and manage consumer upgrades and rollbacks.
  7. Part 7

    Advanced integrations and data

    1. 32 OAuth for separate accounts Choose an Apps Script user token, a dedicated OAuth grant, or keyless service-account impersonation, then manage token storage and revocation.
    2. 33 Use AI models from Apps Script Classify, extract, and summarize Google Sheet rows with Gemini, OpenAI, or Claude in Apps Script using UrlFetchApp, validated JSON, and human review.
    3. 34 Answer a request in Google Chat Build a private Apps Script Chat app that reads fictional requests, returns a useful card, and handles its message and removal lifecycle.
    4. 35 GitHub issues and Actions events Call the GitHub REST API from Google Apps Script with UrlFetchApp and a scoped token, then receive an authenticated receipt from GitHub Actions.
    5. 36 Keep one Sheets chart up to date Use Sheet.newChart() and EmbeddedChartBuilder in Google Apps Script to build a chart from Sheet rows, record its chart ID, and update presentation.
    6. 37 Package CSV, JSON, and a PDF for handoff Validate a supplies table in Google Apps Script, export CSV or JSON blobs with Utilities.newBlob(), and package a Google Doc PDF with getAs().
  8. Part 8

    Reference and glossary

    1. 38 Reference, glossary, and troubleshooting Find the right Apps Script term, service reference, example, or troubleshooting guide when maintaining a production script.