Author: By Raj
Part of our Google Sheets Automation Expert guides. Need this built for your team? Hire a Google Apps Script developer.
Estimated reading time: 8 minutes
Auto-Generate Reports from Google Sheets with Apps Script
Repeating the same report, daily sales, weekly pipeline, monthly summaries, by hand is slow and error-prone. Auto-generating reports from Google Sheets with Apps Script lets you schedule them: the script reads sheet data (optionally filtered or aggregated), builds a report (e.g. PDF from a template or HTML email), and sends it via Gmail or saves to Drive. Time-driven triggers run daily or weekly; you control batching so many reports stay within execution and email quotas. This guide covers architecture, implementation, and scaling.
Common mistakes
- Generating one report per recipient in a long loop (execution time and Gmail limits).
- No template; building HTML or PDF from scratch in code (brittle).
- Not filtering data by date or segment before building the report.
- Assuming all reports can run in one 6-minute window.
- No error logging when email or PDF generation fails.
Architecture
Flow: Sheet(s) (source) → time-driven trigger → script reads data (filter by date/segment if needed) → build report (e.g. copy Doc/Sheet template, fill placeholders, export PDF; or build HTML body) → send email with attachment or save to Drive and share. Use a “Report config” sheet for recipients and report type. For many reports, process N per run and use a status column or queue. Execution time limits apply; chunk work and use continuation triggers if needed. Web apps can expose a “Generate report” button for on-demand runs.
Implementation
Data and template
Read from a data sheet (or multiple); filter rows by date range or segment. Use a report template (Doc or Sheet) with placeholders; copy, replace text, export PDF. For simple tables, build HTML in code and send as email body.
Scheduled send
function sendWeeklyReport() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const dataSheet = ss.getSheetByName("Sales");
const lastRow = dataSheet.getLastRow();
if (lastRow < 2) return;
const numRows = lastRow - 1;
const data = dataSheet.getRange(2, 1, 2 + numRows - 1, 5).getValues();
var total = 0;
for (var i = 0; i < data.length; i++) total += Number(data[i][4]) || 0;
const html = "<h1>Weekly Sales</h1><p>Total: " + total + "</p>";
GmailApp.sendEmail(Session.getActiveUser().getEmail(), "Weekly Sales Report", "", { htmlBody: html });
}Example: A team sent a weekly pipeline summary to managers. Script pulled pipeline sheet, filtered by “Open,” aggregated by stage, filled a Doc template, exported PDF, and emailed to a list from a config sheet. Report generation went from ~45 minutes/week to zero.
Sending one summary report per run keeps execution under a minute; for 10+ personalized reports, batch to ~5 per run.
Need scheduled reports from your Sheets with PDF or email delivery?
Discuss your setupScalability and quotas
Gmail send limits (e.g. 100–1,500/day depending on account), Drive create/export, and 6-minute execution apply. Batch reports (5–10 per run), use time-driven triggers, and log failures. API integrations can push report links to Slack or other systems.
Enterprise scaling
One trigger per report job; document recipients and schedule. Use Script Properties for config. Separate workbooks per department if needed. Monitor execution and email bounce logs.
FAQ
How much does it cost to auto-generate reports from Sheets?
Sheets and Apps Script are in Workspace. Cost is development or maintenance. No per-report fee. Email and Drive storage apply.
What are the limits for scheduled reports?
6-minute execution per run; Gmail send and Drive quotas apply. For many recipients or large PDFs, batch reports (e.g. 10–20 per run) and use time-driven triggers.
Are report contents secure?
Reports are generated and sent from your Workspace. Data stays in your Drive and Gmail. Use sharing and Script Properties for credentials.
When to use BI tools instead of Sheets reports?
Use BI for interactive dashboards and complex analytics. Use Sheets + Apps Script for scheduled, template-based reports and email distribution from existing sheet data.
About the author
Raj is an Apps Script and Google Workspace automation specialist. He builds scheduled reports and dashboard automation for teams.
More about RajGet the full Apps Script script template
I'll email you a production-ready, commented version you can deploy in 10 minutes.
Continue reading
Google Sheets Automation
Google Sheets CRM Automation: Triggers, Pipelines, and Follow-Ups
Google Sheets Automation
Google Sheets Dashboard Automation with Apps Script
Google Sheets Automation
Automate Inventory Management in Google Sheets with Apps Script
From another topic
How to Automate Google Sheets with Apps Script (Beginner Guide) →Need help with this? I handle this as part of my Google Sheets Automation Expert service.
CRM, dashboards, invoices, inventory, and report automation in Sheets.
See how it works →