📋 Get Email Notifications for Edits in Google Spreadsheet

1. Overview

\[ \begin{array}{l} \textbf{Google Apps Script can send automated email alerts --} \\ \text{whenever a Google Spreadsheet is edited.} \\ \textbf{This is helpful for approvals, team monitoring, or sensitive data tracking --} \\ \text{using installable or simple onEdit triggers.} \end{array} \]

2. Use Cases

            
                - Notify managers when team members update specific cells
                - Alert users when inventory, budget, or form responses change
                - Log unauthorized edits to critical spreadsheets
                - Automate workflows based on real-time sheet changes
            
        
These email alerts increase visibility and accountability across collaborative spreadsheets.

3. Basic onEdit() Email Notification Script

            
                function onEdit(e) {
                  const range = e.range;
                  const sheet = range.getSheet();
                  const editedCell = range.getA1Notation();
                  const newValue = e.value;

                  const email = "[email protected]";
                  const subject = `Edit in ${sheet.getName()}`;
                  const message = `
                    Cell ${editedCell} in sheet '${sheet.getName()}' was changed to:
                    "${newValue}"
                  `;

                  MailApp.sendEmail(email, subject, message);
                }
            
        
This function sends an email every time a cell is edited. Works best for simple change tracking.

4. Use an Installable Trigger for Full Access

            
                // Installable trigger version
                function notifyOnEdit(e) {
                  const sheet = e.range.getSheet();
                  const cell = e.range.getA1Notation();
                  const user = Session.getActiveUser().getEmail() || "Unknown";
                  const message = `
                    ${user} edited ${cell} in ${sheet.getName()}.
                    New value: ${e.value}
                  `;
                  
                  MailApp.sendEmail("[email protected]", "Spreadsheet Edit Alert", message);
                }
            
        
Set this up in **Apps Script > Triggers** → add trigger → choose `notifyOnEdit`, event type: "On edit". This allows detection of the editing user's email (when available).

5. Send Alerts Only for Specific Columns or Values

            
                function onEdit(e) {
                  const range = e.range;
                  const col = range.getColumn();
                  const sheet = range.getSheet();
                  const value = e.value;

                  if (sheet.getName() === "Tasks" && col === 5 && value === "Done") {
                    MailApp.sendEmail("[email protected]", "Task Completed!", `A task was marked done.`);
                  }
                }
            
        
This version only sends alerts when column E (5) is updated to "Done" in the "Tasks" sheet.

6. Optional: Log All Edits in a "Log" Sheet

            
                function logAndNotify(e) {
                  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Log");
                  const range = e.range;
                  const time = new Date();
                  const user = Session.getActiveUser().getEmail() || "Unknown";

                  sheet.appendRow([
                    time,
                    range.getSheet().getName(),
                    range.getA1Notation(),
                    e.value,
                    user
                  ]);

                  MailApp.sendEmail("[email protected]", "Edit Logged", `Change in ${range.getA1Notation()} logged.`);
                }
            
        
This appends all edits to a log sheet and sends notifications — ideal for audits and sensitive sheets.

7. Conclusion

            
                With Google Apps Script, you can monitor sheet changes, trigger real-time alerts, 
                and track edits seamlessly. Whether for team dashboards or sensitive financial sheets, 
                this automation improves awareness and governance.
            
        
Use installable triggers for more secure, detailed edit tracking including user info and flexible logic.