📧 Send Custom Emails from Google Sheets Using Apps Script
If you’ve ever needed to send personalized emails to multiple recipients—such as confirmation emails, reminders, or announcements—Google Apps Script offers a powerful way to automate this process using data from a Google Sheet.
In this post, you’ll learn how to create a simple mail merge that sends customized messages to each person listed in your sheet.
🧩 Use Case
You have a spreadsheet with a list of names, email addresses, and messages. You want to automatically send each person an email with a personalized greeting and message.
📋 Sample Sheet Layout
Name | Message | |
---|---|---|
John | john@email.com | Your report is ready. |
Maria | maria@email.com | Please confirm your task. |
✍️ Google Apps Script Code
function sendCustomEmails() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getRange(2, 1, sheet.getLastRow() - 1, 3).getValues();
data.forEach(row => {
const [name, email, message] = row;
const subject = `Hello ${name}, here’s your update!`;
const body = `Hi ${name},\n\n${message}\n\nBest regards,\nYour Team`;
if (email) {
MailApp.sendEmail(email, subject, body);
}
});
}
🛡️ Safety Tips
- Test with your own email first before running the full script.
- Use
Logger.log()
to preview messages without sending them. - If sending to many users, consider quotas: Gmail has daily sending limits.
🧠 Bonus: Add a Status Column
To prevent sending emails multiple times, add a “Status” column and update it after each email is sent:
sheet.getRange(index + 2, 4).setValue('Sent');
This marks each row as processed, so you can skip it on the next run.
🚀 Wrapping Up
Using Google Apps Script with Sheets makes it incredibly easy to run small-scale, custom email campaigns—no add-ons required. With just a few lines of code, you can boost your communication efficiency and save valuable time.
