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); } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter