How to Automatically Send Gmail from Google Sheets Using Apps Script
Google Sheets is much more than a place to store numbers and lists. With Google Apps Script, you can turn a spreadsheet into a simple automation system that sends an email whenever a specific cell or row is edited.
This can be useful for student records, customer follow-ups, order tracking, employee tasks, website inquiries, project management, and notifications.
The important point is that a basic onEdit(e) trigger cannot directly send email because simple triggers cannot use services that require authorization. For email automation, you should normally create an installable edit trigger. Google officially supports installable edit triggers for Google Sheets.
What Does "Send Email on Edit" Mean?
Imagine you have a Google Sheet like this:
| Name | Status | |
|---|---|---|
| John | john@example.com | Pending |
| Sarah | sarah@example.com | Pending |
| David | david@example.com | Pending |
You want an email to be sent automatically when the Status changes to Approved.
Instead of checking the spreadsheet manually, Apps Script can watch the edit and send the email.
The basic workflow is:
User edits cell → Apps Script detects edit → Script checks the condition → Email is sent
This small automation can save a surprising amount of repetitive work.
Why Use Google Apps Script?
Google Apps Script is Google's JavaScript-based automation platform for Google Workspace.
It can interact with services such as:
- Google Sheets
- Gmail
- Google Drive
- Google Docs
- Google Forms
- Google Calendar
Google also provides official automation examples showing how Sheets data can be used to send emails.
The biggest advantage is that you don't need to install separate software.
Important: onEdit() vs Installable Edit Trigger
This is where many beginners make a mistake.
You may find code like:
function onEdit(e) {
MailApp.sendEmail("someone@example.com", "Sheet Updated", "A cell was edited.");
}
It looks correct, but it is not the recommended approach.
A simple onEdit(e) trigger cannot use services that require authorization, including services needed to send email.
Instead, create a normal function and connect it to an installable edit trigger.
Example: Send an Email When Status Becomes "Approved"
Suppose your sheet has:
- Column A = Name
- Column B = Email
- Column C = Status
You want an email sent when Column C becomes Approved.
Open your spreadsheet and go to:
Extensions → Apps Script
Delete the existing code and add:
function sendEmailOnEdit(e) {
const sheet = e.range.getSheet();
// Only run on the "Sheet1" sheet
if (sheet.getName() !== "Sheet1") return;
const row = e.range.getRow();
const column = e.range.getColumn();
// Ignore the header row
if (row === 1) return;
// Only react to edits in Column C
if (column !== 3) return;
const status = e.range.getValue();
// Only send email when status becomes Approved
if (status !== "Approved") return;
const name = sheet.getRange(row, 1).getValue();
const email = sheet.getRange(row, 2).getValue();
if (!email) return;
const subject = "Your Status Has Been Approved";
const message =
"Hello " + name + ",\n\n" +
"Your status has been changed to Approved.\n\n" +
"Thank you.";
MailApp.sendEmail(email, subject, message);
}
This code does not send an email for every edit.
It checks several conditions first.
What the script checks
- Is the edit happening on
Sheet1? - Is it below the header?
- Was Column C edited?
- Did the new value become
Approved? - Is there an email address?
Only then does it send the email.
That is a much safer approach than sending an email every time somebody touches the spreadsheet.
How to Create the Trigger
After saving the script:
- Open the Apps Script editor.
- Click the Triggers icon on the left.
- Click Add Trigger.
- Choose the function:
sendEmailOnEdit - For the event source, select: From spreadsheet
- For the event type, select: On edit
- Click Save.
- Google will ask you to authorize the script.
- Review the permissions and allow them if you trust the script.
Google's official documentation describes the same process: open the Apps Script project, select Triggers, click Add Trigger, configure the trigger, and save it.
Test the Automation
Now return to your spreadsheet.
For example:
| Name | Status | |
|---|---|---|
| John | your-email@example.com | Pending |
Change:
Pending → Approved
The installable edit trigger should run the function and send the email.
Give it a short moment before assuming that it failed.
A Better Version: Prevent Duplicate Emails
There is an important problem with simple automation.
Suppose you change the status to Approved.
The email is sent.
Later, you accidentally change it to Pending, and then change it back to Approved.
The script may send another email.
For important workflows, you can add an Email Sent column.
For example:
| Name | Status | Email Sent | |
|---|---|---|---|
| John | john@example.com | Approved | Yes |
The script can then refuse to send another email if the notification has already been sent.
function sendEmailOnEdit(e) {
const sheet = e.range.getSheet();
if (sheet.getName() !== "Sheet1") return;
const row = e.range.getRow();
const column = e.range.getColumn();
if (row === 1 || column !== 3) return;
const status = e.range.getValue();
if (status !== "Approved") return;
const name = sheet.getRange(row, 1).getValue();
const email = sheet.getRange(row, 2).getValue();
const emailSent = sheet.getRange(row, 4).getValue();
if (!email || emailSent === "Yes") return;
MailApp.sendEmail({
to: email,
subject: "Your Application Has Been Approved",
body:
"Hello " + name + ",\n\n" +
"Your application has been approved.\n\n" +
"Thank you."
});
sheet.getRange(row, 4).setValue("Yes");
}
This approach is much better for real-world automation.
Send a Professional HTML Email
Plain text works, but HTML emails can look more professional.
For example:
function sendEmailOnEdit(e) {
const sheet = e.range.getSheet();
if (sheet.getName() !== "Sheet1") return;
const row = e.range.getRow();
const column = e.range.getColumn();
if (row === 1 || column !== 3) return;
const status = e.range.getValue();
if (status !== "Approved") return;
const name = sheet.getRange(row, 1).getValue();
const email = sheet.getRange(row, 2).getValue();
if (!email) return;
const htmlBody = `
<div style="font-family:Arial,sans-serif;line-height:1.6;">
<h2>Your Application Has Been Approved</h2>
<p>Hello <strong>${name}</strong>,</p>
<p>
We are pleased to inform you that your application
has been approved.
</p>
<p>Thank you.</p>
</div>
`;
MailApp.sendEmail({
to: email,
subject: "Application Approved",
htmlBody: htmlBody
});
}
Google's Apps Script documentation provides examples of using MailApp.sendEmail() with HTML email content.
You Can Trigger Emails for Different Conditions
The same concept can be adapted to many situations.
1. When a new customer is added
You could send:
Thank you for contacting us. We have received your information.
2. When an order becomes completed
The customer could receive an automatic confirmation.
3. When a student's result is published
The spreadsheet could send a result notification.
4. When a task becomes overdue
A manager could receive an alert.
5. When payment status changes
The system could notify the appropriate person.
6. When an employee changes a project status
The project manager could receive an automatic notification.
Can You Send Email When Any Cell Is Edited?
Yes, but you should be careful.
You could write a script that reacts to almost any edit:
function sendEmailOnEdit(e) {
const range = e.range;
MailApp.sendEmail(
"admin@example.com",
"Google Sheet Edited",
"Cell " + range.getA1Notation() + " was edited."
);
}
However, I would not recommend this for a large or frequently edited spreadsheet.
A spreadsheet can generate many edits.
Sending an email for every edit can quickly become annoying and may consume your available email quota.
A better design is to react only to important events.
Use a Specific Column
This is one of my favorite approaches for beginner-friendly automation.
For example:
Column F = Send Email
The user selects:
Yes
Then the script sends the email.
This gives you human control over the automation.
Example:
if (column !== 6) return;
if (e.value !== "Yes") return;
This is often safer than trying to interpret every change in the spreadsheet.
Add a Timestamp
You can also record when the notification was sent.
For example:
| Name | Status | Email Sent | Sent Time |
|---|---|---|---|
| John | Approved | Yes | 15 Sep 2026, 4:30 PM |
You can add:
sheet.getRange(row, 5).setValue(new Date());
This creates a basic audit trail.
For business workflows, this can be extremely useful.
Important Limitations
Google Apps Script is powerful, but it is not unlimited.
Google publishes quotas for Apps Script services. At the time of writing, the documented daily email-recipient quota is 100 recipients/day for consumer accounts and 1,500 recipients/day for Google Workspace accounts, with different limits for recipients within a Workspace domain. Google also states that quotas can change.
There are also limits such as:
- Maximum 50 recipients per message
- Maximum 6 minutes per script execution
- Limits on the number of triggers
- Daily execution limits
These restrictions matter if you are building a high-volume email system.
For a small personal spreadsheet or school/business workflow, these limits may be more than sufficient. For mass email marketing, however, Apps Script is usually not the right tool.
What Happens If the Script Fails?
Installable triggers run automatically, so you may not see an error immediately.
Google says that when an installable trigger fails, Apps Script can send a failure notification email, and you can inspect the execution history in Apps Script.
To troubleshoot:
Apps Script → Executions
Look for:
- Failed executions
- Authorization problems
- Invalid email addresses
- Quota errors
- Script errors
This is one of the first places I would check if an automation suddenly stops working.
A Few Common Mistakes
Mistake 1: Using simple onEdit() for email
This is the most common beginner mistake.
Use an installable edit trigger when authorization is required.
Mistake 2: Sending an email for every edit
This can generate unnecessary emails.
Use conditions.
Mistake 3: Not checking the email address
Always verify that the email field isn't empty.
Mistake 4: Not preventing duplicate notifications
An Email Sent column is a simple solution.
Mistake 5: Forgetting quotas
Large-scale automation can hit Apps Script limits.
Does Editing a Cell Through Another Script Trigger the Email?
Generally, no.
Google explains that script executions and API requests do not cause edit triggers to fire. For example, changing a cell programmatically with Range.setValue() does not cause an onEdit trigger to execute.
This distinction is important.
A human editing a cell and a script changing a cell are not necessarily equivalent events.
My Recommended Setup
If you are new to Google Apps Script, I recommend this structure:
Column A: Name
Column B: Email
Column C: Status
Column D: Email Sent
Column E: Sent Time
Then use a workflow such as:
Status = Approved → Check Email Sent → Send Email → Mark Email Sent = Yes → Record timestamp
This is simple, understandable, and much easier to troubleshoot than a complicated automation.
The Future of Google Sheets Automation
I think spreadsheet automation will become increasingly useful as AI becomes more deeply integrated with everyday office tools.
The important change is not simply sending emails.
The bigger opportunity is connecting information across a workflow.
For example:
Google Form → Google Sheet → automatic validation → email → document generation → follow-up reminder
That can turn an ordinary spreadsheet into a lightweight business application.
For students and small organizations, this is particularly interesting because it can provide useful automation without requiring an expensive software platform.
My advice is to start small. Automate one repetitive task first. Once it works reliably, add more features.
Final Checklist
Before using your automation, check:
- Google Apps Script is attached to the correct spreadsheet
- The function name is correct
- An installable edit trigger has been created
- The required permissions have been authorized
- The correct sheet name is used
- The correct column is being monitored
- Email addresses are valid
- Duplicate emails are prevented
- Your email quota is sufficient
- The Apps Script execution history is checked when troubleshooting
Conclusion
Automatically sending email from Google Sheets when a cell is edited is one of the most practical beginner-level Google Apps Script projects.
The key is to avoid treating every edit as an email event. Instead, identify a meaningful condition such as Approved, Completed, Paid, or Send Email = Yes.
For simple workflows, this can save time and reduce repetitive manual work.
If you are building something important, also add an Email Sent field and timestamp. That small improvement can prevent duplicate notifications and make your automation much easier to manage.
Ready to try it? Start with one spreadsheet, one condition, and one email. Once that works, gradually expand the workflow.
Disclaimer: Apps Script quotas, Google Workspace features, and Google interface options can change. Always check Google's current documentation before building a high-volume or business-critical email system.

0 Comments