# Google Apps Script guides and examples

> Practical Google Apps Script guides covering UrlFetchApp, databases, authentication, Gemini, MCP, performance, security, and Google Workspace automation.

Canonical HTML guide: https://justin.poehnelt.com/google-apps-script/ (27 articles).

## Start here

The broadest guides for HTTP requests, storage, AI, and external databases.

- [UrlFetchApp: The Unofficial Documentation](https://justin.poehnelt.com/posts/definitive-guide-to-urlfetchapp.md) (2025-12-21): The unofficial guide to Google Apps Script UrlFetchApp. Master authentication, fetchAll for parallelism, web scraping, and debugging "Address Unavailable".
- [Apps Script Storage Benchmarks](https://justin.poehnelt.com/posts/apps-script-key-value-stores.md) (2024-03-16): Benchmarks comparing CacheService, PropertiesService, and Firestore in Apps Script, including speed measurements and when each storage option fits.
- [Using Gemini in Apps Script](https://justin.poehnelt.com/posts/using-gemini-in-apps-script.md) (2026-01-12): Use Apps Script's Vertex AI advanced service to call Gemini for text, images, structured output, search grounding, and multi-turn chat.
- [PostgreSQL from Google Apps Script](https://justin.poehnelt.com/posts/apps-script-postgresql.md) (2026-02-17): Connect Apps Script to PostgreSQL via JDBC, including connection strings, JSONB and UUID workarounds, transactions, and PostGIS.

## Core platform and runtime

Understand Apps Script's runtime, HTTP client, storage, caching, web apps, and WebAssembly support.

- [UrlFetchApp: The Unofficial Documentation](https://justin.poehnelt.com/posts/definitive-guide-to-urlfetchapp.md) (2025-12-21): The unofficial guide to Google Apps Script UrlFetchApp. Master authentication, fetchAll for parallelism, web scraping, and debugging "Address Unavailable".
- [Apps Script V8 Runtime Limitations](https://justin.poehnelt.com/posts/apps-script-runtime-limitations-wintercg.md) (2024-02-29): A comparison of the WinterCG minimum common web APIs and Apps Script's V8 runtime, including UrlFetchApp and sleep workarounds.
- [Promises, async and await in Google Apps Script](https://justin.poehnelt.com/posts/apps-script-async-await.md) (2024-02-07): Understand async/await and Promises in Google Apps Script. Learn why most APIs remain synchronous and how WebAssembly is the exception.
- [Using WebAssembly in Google Apps Script](https://justin.poehnelt.com/posts/apps-script-wasm.md) (2024-04-04): How I compile Rust to WebAssembly, bundle it with JavaScript, and run it in Google Apps Script, with examples and performance notes.
- [Apps Script Storage Benchmarks](https://justin.poehnelt.com/posts/apps-script-key-value-stores.md) (2024-03-16): Benchmarks comparing CacheService, PropertiesService, and Firestore in Apps Script, including speed measurements and when each storage option fits.
- [Apps Script CacheService Limits](https://justin.poehnelt.com/posts/exploring-apps-script-cacheservice-limits.md) (2025-12-22): Unofficial Apps Script CacheService findings: key and value limits, FIFO batch eviction, edge cases, and practical cache patterns.
- [Memoization in Apps Script](https://justin.poehnelt.com/posts/apps-script-memoization.md) (2023-12-11): A generic Apps Script memoization helper that hashes a function and arguments, stores results in CacheService, and explains its limits.
- [google.script.run vs. doGet/doPost](https://justin.poehnelt.com/posts/apps-script-google-script-run-vs-get-post.md) (2024-03-29): Compare google.script.run vs doGet/doPost endpoints for Apps Script web apps. Choose the best method for simple apps or complex frameworks like React/Vue.

## AI and agents

Use Gemini, Vertex AI, MCP, and Model Armor from Apps Script.

- [Using Gemini in Apps Script](https://justin.poehnelt.com/posts/using-gemini-in-apps-script.md) (2026-01-12): Use Apps Script's Vertex AI advanced service to call Gemini for text, images, structured output, search grounding, and multi-turn chat.
- [Building an MCP Client in Google Apps Script](https://justin.poehnelt.com/posts/mcp-client-apps-script.md) (2026-01-15): Learn how to communicate with Model Context Protocol (MCP) servers using Apps Script and UrlFetchApp. Incorporate the MCP client into Vertex AI tool calling.
- [Using Vertex AI in Apps Script](https://justin.poehnelt.com/posts/apps-script-vertex-ai.md) (2023-12-11): How to use the Vertex AI API in Apps Script to make predictions on your data or use it in any of your other Google Workspace processes.
- [Generating Text with Gemini Pro in Apps Script](https://justin.poehnelt.com/posts/apps-script-gemini-pro-text.md) (2023-12-19): A short Apps Script example that calls the Gemini Pro REST API to generate text, then reads the response candidate text.
- [Protect Gmail AI Agents with Model Armor](https://justin.poehnelt.com/posts/building-secure-ai-agents-mcp.md) (2025-12-18): Use Model Armor in an MCP tool handler to block prompt injection and redact sensitive Gmail content before it reaches an AI agent.

## Data, authentication, and integrations

Connect databases, manage credentials and OAuth scopes, and work with Drive, Docs, and Forms.

- [PostgreSQL from Google Apps Script](https://justin.poehnelt.com/posts/apps-script-postgresql.md) (2026-02-17): Connect Apps Script to PostgreSQL via JDBC, including connection strings, JSONB and UUID workarounds, transactions, and PostGIS.
- [Using Firestore in Apps Script](https://justin.poehnelt.com/posts/apps-script-firestore.md) (2024-01-10): Use the Firestore REST API from Google Apps Script when CacheService, PropertiesService, or Sheets cannot meet your storage requirements.
- [Apps Script Service Account Impersonation](https://justin.poehnelt.com/posts/apps-script-service-account-impersonation.md) (2024-01-10): Avoid downloading service-account keys: use impersonation in Apps Script to mint access tokens for Google Cloud APIs.
- [Secure Secrets in Google Apps Script](https://justin.poehnelt.com/posts/secure-secrets-google-apps-script.md) (2025-12-19): Avoid hardcoded Apps Script secrets by using PropertiesService for configuration and Google Cloud Secret Manager for sensitive values.
- [Currentonly Scopes in Google Apps Script](https://justin.poehnelt.com/posts/apps-script-currentonly-scopes.md) (2026-01-06): How Apps Script currentonly scopes limit access to an active file, and why Advanced Services, direct API calls, and openById need full scopes.
- [Drive File Get Blob and Scopes in Google Apps Script](https://justin.poehnelt.com/posts/apps-script-drive-file-get-blob.md) (2024-03-27): Compare DriveApp, the Drive Advanced Service, and UrlFetchApp for retrieving Drive file blobs in Apps Script while minimizing OAuth scopes.
- [Convert docx to Google Docs with Apps Script](https://justin.poehnelt.com/posts/apps-script-docx-documentapp.md) (2024-04-30): Programmatically convert, open, and edit Microsoft Word .docx files in Google Apps Script using the Drive API and DocumentApp.
- [Google Forms: title vs name vs documentTitle](https://justin.poehnelt.com/posts/google-form-title-vs-name.md) (2024-10-29): Recently I had to clarify some confusion around the title and name of a Google Form. Here is a quick explanation of the difference between the two.

## Automation, add-ons, and field notes

Practical automations, add-on architecture, performance measurements, and conference material.

- [Combining Google Workspace Add-ons and Editor Add-ons](https://justin.poehnelt.com/posts/google-workspace-add-ons-editor-add-ons-combined.md) (2023-11-30): Both Add-on types have their own strengths and weaknesses. Combining them could be a powerful way to build Add-ons for Google Workspace but with some caveats.
- [Automate Email Bankruptcy using Apps Script](https://justin.poehnelt.com/posts/automate-email-bankruptcy-using-apps-script.md) (2020-04-28): An Apps Script that archives Gmail threads older than 30 days, respects Gmail's 100-thread batch limit, and runs hourly on a trigger.
- [Archiving Dependabot Emails with Apps Script](https://justin.poehnelt.com/posts/archive-github-dependabot-semantic-release-emails-with-appscript.md) (2022-05-26): Archive Dependabot and Semantic Release emails automatically using Google Apps Script cron jobs to declutter your inbox.
- [Google Cloud Region Latency in Google Apps Script](https://justin.poehnelt.com/posts/apps-script-gcp-region-latency.md) (2024-03-15): Ping results to Google Cloud regions and  short code snippet demonstrating how to measure latency from Google Apps Script.
- [Rust, Python, and WASM in Apps Script](https://justin.poehnelt.com/posts/2024-google-next-talk-rust-python-apps-script.md) (2024-02-27): A Google Next 2024 lightning talk on extending Apps Script with Rust, Python, and WebAssembly, with a build demonstration.
- [Google Workspace Developer Summits 2024](https://justin.poehnelt.com/posts/2024-workspace-developer-summits.md) (2024-04-24): Save the date for the 2024 Google Workspace Developer Summits in Boston on September 12 and Berlin on September 17.
