How to Email a Range of Google Spreadsheet Cells – A Complete Guide
Google Sheets is more than just a place to store data — it’s a powerful tool for automating reports, alerts, and data sharing. One especially useful feature is the ability to email a selected range of cells directly from the spreadsheet.
Whether you want to send a weekly sales report, share a dynamic table with your team, or send customer-specific data on demand, you can do it programmatically using Google Apps Script.
In this complete guide, you’ll learn how to email a specific range of Google Spreadsheet cells — formatted like a mini-table — directly into the body of an email. No downloads, no copy-pasting, just clean, automated email reports straight from your spreadsheet.
You might want to email a range of cells for several reasons:
Scheduled reports (daily/weekly summaries)
Triggered alerts when specific values change
Sharing filtered data with clients or teams
Sending personalized data for each recipient
Automation of recurring tasks
Google Apps Script makes it easy to pull data from a sheet and email it in a well-formatted layout using simple JavaScript.
Set up your spreadsheet with some sample data. Example:
| Name | Department | Sales |
|---|---|---|
| Alice | Marketing | 5000 |
| Bob | Sales | 7000 |
| Carol | IT | 4000 |
Let’s say this is in range A1:C4.
In your Google Sheet, click on Extensions > Apps Script.
Delete any default code in Code.gs.
Here’s the complete script:
function emailSpreadsheetRange() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
const range = sheet.getRange("A1:C4"); // Update as needed
const values = range.getValues();
let htmlTable = '<table border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse;">';
values.forEach((row, rowIndex) => {
htmlTable += "<tr>";
row.forEach(cell => {
const cellTag = rowIndex === 0 ? "th" : "td"; // Header row uses <th>
htmlTable += `<${cellTag}>${cell}</${cellTag}>`;
});
htmlTable += "</tr>";
});
htmlTable += "</table>";
const recipient = "recipient@example.com"; // Change to your email
const subject = "Weekly Sales Report";
const body = "Please find the current report below:<br><br>" + htmlTable;
GmailApp.sendEmail(recipient, subject, "", {
htmlBody: body
});
Logger.log("Email sent successfully.");
}
getRange("A1:C4"): Defines which range of cells to email.
getValues(): Pulls the cell contents as a 2D array.
HTML Table Formatting:
The first row is wrapped in <th> (headers).
Remaining rows use <td>.
GmailApp.sendEmail():
Sends the email using the Gmail account connected to the sheet.
The htmlBody parameter formats the email to preserve the table layout.
Logger: Confirms successful execution in the Apps Script logs.
Click the disk icon to save your project.
Click the Run ▶ button on emailSpreadsheetRange.
The first time, it will prompt you to authorize permissions.
After confirming, the email will be sent with your selected range formatted in a table.
You may want to make the script more dynamic:
const range = sheet.getRangeByName("SalesTable");
const lastRow = sheet.getLastRow();
const range = sheet.getRange(1, 1, lastRow, 3); // 3 columns from row 1
const emailTo = sheet.getRange("F1").getValue(); // Email in cell F1
You can enhance the table by adding CSS inline styles:
<th style="background-color:#f2f2f2;font-weight:bold;">...</th>
Full example:
htmlTable += `<th style="background-color:#f2f2f2;">${cell}</th>`;
You can also wrap the email with custom branding:
const body = `
<div style="font-family:Arial, sans-serif;">
<h2 style="color:#333;">Weekly Report</h2>
${htmlTable}
<p>Sent automatically from Google Sheets.</p>
</div>
`;
In Apps Script, go to the clock icon (Triggers).
Click Add Trigger.
Choose the function emailSpreadsheetRange.
Set to run time-driven, daily or weekly.
Now your reports will go out on autopilot.
Daily or Weekly Sales Reports
Project status reports
School attendance summaries
Inventory alerts
KPI dashboards
If the script fails:
Check for typos in the range reference.
Ensure the email address is valid.
If the email is blank:
Verify that your range actually contains data.
If formatting looks wrong:
Use inline styles and make sure htmlBody is used (not plain body).
If permissions error appears:
Run the script manually once to authorize.
With just a few lines of Google Apps Script, you can email a selected range from your Google Spreadsheet — formatted neatly as an HTML table — to any recipient you choose. It’s a powerful and practical automation that can replace countless hours of copy-pasting, file downloads, or manual formatting.
Use this technique to send reports, summaries, notifications, or customized datasets directly from your spreadsheet — on demand or automatically — and supercharge your workflow with the power of Apps Script.