send mail when one coloumn is changed works on onedit trigger also modify in if statement
Mon Sep 19 2022 11:28:43 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("APPROVE PURCHASE");
//Check if edit is done in Sheet "X_input"
if(editedSheet.getName()=="APPROVE PURCHASE"){
//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<=1000 && col==9 && col==9)
{
//Send email
var subject = "Sheet: "+editedSheet.getName();
var message = "Cell "+editedCell.getA1Notation()+" was modified from '"+e.oldvalue+"' to '"+e.value+"'";
MailApp.sendEmail("ashwani.kumar1@meenakshipolymers.com",subject,message);
}
}
}
content_copyCOPY
Comments