1

I have this script running which works fine. However as you see, it only copies the information of the active cell in Column 10 toString. How can I get the information next to it in Column 11 to be included in the email? I've tried numerous options without luck.

function sendNotification() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getActiveSheet();
    if(sheet.getName()=='Dispatch Log'){
  var cell = ss.getActiveCell();
  var cellcol = cell.getColumn();
      if(cellcol == 10){
  var cellvalue = ss.getActiveCell().getValue().toString();
  var recipients = "tor@domain.com";
  var subject = 'Pickup Requested '+cellvalue;
  var body = 'A new Pickup has been placed for ' + cellvalue + '. Please coordinate with dispatch.';
  MailApp.sendEmail(recipients, subject, body);}
    }
} 

0

I don't really understand what you want, but you can try to change from:

var cellcol = cell.getColumn();

to:

var cellcol = cell.getLastColumn();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.