ranjithkumar10

Send email from google sheets based on active row

Aug 12th, 2016
1,125
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function activeRowEmail() {
  2. var sheet = SpreadsheetApp.getActiveSheet();
  3. var activeRow = sheet.getActiveCell().getRowIndex();
  4. var name = sheet.getRange(activeRow, 1).getValue();
  5. var email = sheet.getRange(activeRow, 2).getValue();
  6. var score = sheet.getRange(activeRow, 3).getValue();
  7. MailApp.sendEmail(email,"custom email","hello " + name + ", This is an email report of your score. Your score is " + score);
  8. }
  9.  
  10. ##credits - https://codingislove.com
RAW Paste Data