TransWikia.com

How can I get the information from a column next to the active cell to be included in the email?

Web Applications Asked by Mark Easton on November 3, 2021

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 = "[email protected]";
  var subject = 'Pickup Requested '+cellvalue;
  var body = 'A new Pickup has been placed for ' + cellvalue + '. Please coordinate with dispatch.';
  MailApp.sendEmail(recipients, subject, body);}
    }
} 

One Answer

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

var cellcol = cell.getColumn();

to:

var cellcol = cell.getLastColumn();

Answered by asiaboba on November 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP