Send email notification when cell has been edited on a specific google sheets tab - Stack Overflow
Mon Sep 19 2022 09:41:05 GMT+0000 (Coordinated Universal Time)
Saved by
@ash1i
#javascript
function onEdit(e) {
var editedSheet = e.source.getActiveSheet();
var editedCell = e.range;
var row = editedCell.getRow();
var col = editedCell.getColumn();
var ySheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Y_output");
//Check if edit is done in Sheet "X_input"
if(editedSheet.getName()=="X_input"){
//copy modified cell to Y_output sheet
ySheet.getRange(row,col).setValue(e.value);
//check if modified cell is within B2:Y61 range and send an email
if(row>=2 && row<=61 && col>=2 && col<=25){
//Send email
var subject = "Sheet: "+editedSheet.getName();
var message = "Cell "+editedCell.getA1Notation()+" was modified from '"+e.oldvalue+"' to '"+e.value+"'";
MailApp.sendEmail("ronoel@google.com",subject,message);
}
}
}
content_copyCOPY
https://stackoverflow.com/questions/65743355/send-email-notification-when-cell-has-been-edited-on-a-specific-google-sheets-ta
Comments