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 would cost approximately $73.50/month ($882/year). The scripts have run without modification for 14 months.
Related Questions
Related Tools
Activepieces
No-code workflow automation with self-hosting and AI-powered features
Workflow AutomationAutomatisch
Open-source Zapier alternative
Workflow AutomationBardeen
AI-powered browser automation via Chrome extension
Workflow AutomationCalendly
Scheduling automation platform for booking meetings without email back-and-forth, with CRM integrations and routing forms for lead qualification.
Workflow AutomationRelated Rankings
Best Project Management Automation Tools in 2026
A ranked list of the best project management automation tools in 2026. This ranking evaluates platforms across automation engine quality, project views, integration ecosystem, pricing, and scalability for growing teams. The ranking includes dedicated PM platforms with built-in automation (Monday.com, Asana, ClickUp, Jira, Trello), flexible workspace tools used for PM (Notion), and spreadsheet-based PM solutions (Smartsheet).
Best CRM Automation Tools in 2026
A ranked list of the best tools for automating CRM workflows in 2026. This ranking evaluates platforms across CRM depth, automation builder quality, integration ecosystem, pricing value, and enterprise readiness. The ranking includes CRM-native automation platforms (Salesforce Flow, HubSpot Operations Hub, Zoho Flow), general-purpose automation tools (Zapier, Make, Power Automate), and marketing automation tools with CRM capabilities (ActiveCampaign).
Dive Deeper
Notion vs Coda: Complete Comparison (2026)
A comparison of Notion and Coda as database-document hybrid platforms in 2026. Notion offers 30M+ users with a broad template ecosystem and per-member pricing. Coda provides deeper formula-driven logic and Packs integrations with per-doc-maker pricing. Includes cost analysis for teams of 20.
Slack vs Microsoft Teams: Complete Comparison (2026)
A comparison of Slack and Microsoft Teams for workplace automation in 2026. Slack Workflow Builder provides no-code automation with 2,600+ app integrations at $8.75/user/month. Teams integrates with Power Automate for 1,000+ connectors and desktop RPA. Pricing analysis for 50-person organizations included.
Shopify Flow vs Zapier: Complete Comparison (2026)
A comparison of Shopify Flow and Zapier for ecommerce automation in 2026. Shopify Flow is free on Advanced/Plus plans with deep Shopify data access and near-instant execution. Zapier connects 7,000+ apps at $29.99-73.50/month. Includes cost analysis for a 5,000-order store and the hybrid approach.