How to automate Google Sheets with Apps Script
Quick Answer: Automate Google Sheets by opening Extensions > Apps Script, writing JavaScript functions to read/write data, creating custom formulas, and setting up time-based or event-based triggers. Apps Script handles daily reports, email summaries, and API data imports for free.
How to Automate Google Sheets with Apps Script
Google Apps Script provides free, server-side JavaScript automation for Google Sheets. This guide covers creating automated data processing, scheduled reports, and custom functions without external tools.
Step 1: Open the Script Editor
From any Google Sheet, click Extensions > Apps Script. This opens the script editor bound to your spreadsheet, giving the script direct access to the sheet's data.
Step 2: Read and Write Sheet Data
Basic operations:
function processData() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Data");
const data = sheet.getDataRange().getValues(); // 2D array of all data
// Process each row (skip header)
for (let i = 1; i < data.length; i++) {
const name = data[i][0];
const amount = data[i][1];
// Write calculated result to column C
sheet.getRange(i + 1, 3).setValue(amount * 1.1);
}
}
Step 3: Create Custom Functions
Custom functions work like built-in Sheets formulas:
function TAXAMOUNT(subtotal, rate) {
return subtotal * (rate / 100);
}
// Use in sheet as =TAXAMOUNT(A1, 8.5)
Step 4: Set Up Automated Triggers
Triggers run scripts automatically:
- Time-based: Run daily, weekly, or at specific times. Click Triggers (clock icon) > Add Trigger > Time-driven.
- Spreadsheet event: Run when the sheet is edited, opened, or a form is submitted.
- Installable triggers: More flexible than simple triggers, supporting event filtering.
Common automated workflows:
- Daily report generation at 8 AM
- Process new form submissions automatically
- Send email summaries of updated data weekly
Step 5: Send Automated Emails from Sheet Data
function sendWeeklyReport() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Summary");
const data = sheet.getDataRange().getValues();
let report = "Weekly Summary:\n\n";
for (let i = 1; i < data.length; i++) {
report += data[i][0] + ": " + data[i][1] + "\n";
}
GmailApp.sendEmail("[email protected]", "Weekly Report", report);
}
Step 6: Connect to External APIs
function fetchExternalData() {
const response = UrlFetchApp.fetch("https://api.example.com/data", {
headers: { "Authorization": "Bearer YOUR_TOKEN" }
});
const data = JSON.parse(response.getContentText());
// Write to sheet
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("API Data");
data.forEach((item, i) => {
sheet.getRange(i + 2, 1).setValue(item.name);
sheet.getRange(i + 2, 2).setValue(item.value);
});
}
Execution Limits
| Limit | Free Account | Google Workspace |
|---|---|---|
| Execution time per run | 6 minutes | 30 minutes |
| Daily trigger runtime | 90 minutes | 6 hours |
| URL fetch calls per day | 20,000 | 100,000 |
| Email sends per day | 100 | 1,500 |
Editor's Note: We built 8 Apps Script automations for a marketing agency's Google Sheets workflow. Daily KPI calculations, weekly client reports, and monthly billing summaries — all running on time-based triggers at $0/month. The initial development took 12 hours. Running equivalent workflows in Zapier at the time would have cost approximately $73.50/month ($882/year). The scripts have run without modification for 14 months.
Related Questions
Related Tools
Google Apps Script
Free JavaScript-based scripting platform for automating Google Workspace applications including Sheets, Gmail, Docs, Forms, Calendar, and Drive.
Spreadsheet AutomationZapier
Automate workflows between apps without coding—connect 9,000+ tools with simple, reliable automation.
Workflow AutomationMake
Automate your work with visual workflow builder and AI agents
Workflow AutomationActivepieces
No-code workflow automation with self-hosting and AI-powered features
Workflow AutomationRelated Rankings
Best Automation Platforms for AI Orchestration 2026
This ranking answers one question: how many real business applications can an AI agent act on out of the box? It evaluates nine platforms as of August 2026 on the reach they give an agent, not on the workflow logic they can express. That boundary is deliberate, because two neighbouring pages on this site answer different questions. Best Process Orchestration Platforms 2026 scores multi-step process control, error handling and state management. Best AI Agent Platforms 2026 scores building and hosting the agent itself. This page scores the layer between them: the connective tissue that lets an agent already built elsewhere reach the applications a business actually runs on. A platform that leads one of those pages can place low here, and two of them do. Scores derive from application and action catalogue counts, the exposure model each platform uses to publish those catalogues to an agent, setup effort, failure handling and cost per agent action. Every figure was retrieved from a vendor-owned surface on 11 August 2026 unless an earlier date is stated against it.
Best Durable Workflow Engines for Production in 2026
A ranked list of the best durable workflow engines for production deployments in 2026. Durable workflow engines persist execution state to a database so that long-running workflows survive process restarts, deployments, and infrastructure failures. The ranking covers Temporal, Prefect, Apache Airflow, Camunda, Windmill, and n8n. Tools were evaluated on production reliability, developer experience, scalability, open-source health, and documentation quality. The shortlist intentionally mixes code-first engines (Temporal, Prefect, Airflow) with hybrid visual platforms (Camunda, Windmill, n8n) to reflect how production teams actually choose workflow engines in 2026.
Dive Deeper
Keystroke vs n8n in 2026: Agent-Built TypeScript vs the Visual Canvas
Keystroke, launched in July 2026 by Y Combinator W24 company Sprint Labs, is a code-first automation platform where AI coding agents write workflows as TypeScript in the user's repository. n8n, founded in 2019, is the most widely deployed source-available visual workflow platform, with 200,000+ users and a $2.5 billion valuation. This comparison covers the agent-authored versus canvas building models, durable execution, licensing (Elastic License 2.0 vs the Sustainable Use License), verified July 2026 pricing including Keystroke's usage metering, and the maturity gap between a days-old platform and an established ecosystem.
QuantumBPM vs Camunda 2026: Single-Binary Challenger vs the BPMN Incumbent
QuantumBPM (launched 2026, Coroid s.r.o., Slovakia) packages a BPMN 2.0 runtime and DMN 1.5 decision engine into one Go binary backed by Temporal and PostgreSQL. Camunda (Berlin, founded 2013) is the category incumbent: Camunda 7 (Apache 2.0, in maintenance) and the Zeebe-based Camunda 8 platform. This comparison covers product structure, architecture, DMN TCK conformance with recording dates, deployment, pricing, and vendor maturity, verified July 2026.
Migrating 23 Make Scenarios to Self-Hosted n8n: a 3-Week Breakdown
Anonymized retrospective of a DTC ecommerce brand migrating 23 Make scenarios to a self-hosted n8n instance over three weeks. Tooling cost dropped from $348/month on Make Teams to roughly $12/month on a Hetzner VPS, but credential and webhook recreation consumed about 40% of total project time.