Stay informed with real-time alerts whenever changes are made to your Google Spreadsheet. Whether it’s edits, additions, or deletions, you’ll get notified instantly—perfect for team collaboration, tracking data updates, or staying on top of shared project sheets.
- Step 1: Click on the
Copy
button to copy the code snippet. - Step 2: Paste the copied code into your project’s script editor.
Apps Scripts Blog
Apps Scripts Code
function sendEmailOnEdit(e) { if (!e) return; var sheet = e.source.getActiveSheet(); var sheetName = sheet.getName(); var recipients = "sharma.mohit@outrightcrm.com"; var subject = "Someone Edited a Google Sheet"; var body = "The Google Sheet named '" + sheetName + "' was edited. "; // Get the user who made the edit var user = Session.getActiveUser().getEmail(); // Get the range of the edited cell var range = e.range; var row = range.getRow(); var column = range.getColumn(); // Get the new value of the edited cell var newValue = e.value; var header = "<table style='border-collapse: collapse;'><tr><th style='border: 1px solid black; padding: 5px;'>User</th><th style='border: 1px solid black; padding: 5px;'>Row</th><th style='border: 1px solid black; padding: 5px;'>Column</th><th style='border: 1px solid black; padding: 5px;'>Value</th><th style='border: 1px solid black; padding: 5px;'>Date/Time</th></tr>"; // Construct the table row var row = "<tr><td style='border: 1px solid black; padding: 5px;'>" + user + "</td><td style='border: 1px solid black; padding: 5px;'>" + row + "</td><td style='border: 1px solid black; padding: 5px;'>" + column + "</td><td style='border: 1px solid black; padding: 5px;'>" + newValue + "</td><td style='border: 1px solid black; padding: 5px;'>" + new Date().toLocaleString() + "</td></tr>"; // Close the table var footer = "</table>"; document.getElementById("output").innerHTML = header + row + footer;