Skip to content Skip to sidebar Skip to footer

Send Email To Specific Addresses Based On Cell Value Change In Google Sheets

Whenever a cell in column G of my spreadsheet is changed to 'paid', I would like emails to be sent to the addresses contained in columns J and K on the same row, with the email sub

Solution 1:

function onEdit(e) {
  var sh=e.range.getSheet();
  if(e.range.columnStart==7 && e.value.toLowerCase()=='paid' && sh.getName()=='Sheet Name') {
    var vA=sh.getRange(e.range.rowStart,1,1,sh.getLastColumn()).getValues()[0];
    var recipient=Utilities.formatString('%s,%s', vA[9],vA[10]);
    var subject=vA[0];
    GmailApp.sendEmail(recipient, subject, 'Paid');
  }
}

Note: You cannot run this function from the script editor. You will also have to update the SheetName in line 3

Event Objects

Simple Triggers


Post a Comment for "Send Email To Specific Addresses Based On Cell Value Change In Google Sheets"