0

Zapier only provides functionality for monitoring rows. How can I monitor changes made to specific columns?

function sendEmailAlert() {

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var data = ss.getActiveSheet().getActiveCell().getA1Notation();
  var sheetname = ss.getActiveSheet().getName();
  var user = Session.getActiveUser().getEmail();
  var Toemail = '[email protected]';
  var subject = 'New Entry -' + ss.getName();
  var body = 'Your file has a new entry in - ' + sheetname + ' Updated by - ' + user +
    ' check file now- ' + ss.getUrl();
  
  if(getColumn ==2 || getColumn ==3) {
    MailApp.sendEmail(Toemail,subject, body);
 }

};

I'm following the suggestions from "How to send email notifications on Google Spreadsheets if any cell value changes". I don't know what should be inside the if statements and how to trigger the function.

1
  • This question was bumped by the Community User. getColumn is not declared. The question doesn't mention what the problem is with the code and doesn't mention how it's being used. Oct 10, 2023 at 20:24

1 Answer 1

-1
function sendEmailAlert() {

  var ss = SpreadsheetApp.getActiveSpreadsheet();

  var sheetname = ss.getActiveSheet().getName();
  var user = Session.getActiveUser().getEmail();
  var cell = ss.getCurrentCell()
  var col = cell.getColumn();
  var row = cell.getRow();
  
  var Toemail = '[email protected]';
  var subject = 'New Entry -' + ss.getName();
  var body = 'Your file has a new entry in - ' + sheetname + ' Updated by - ' + user +
    ' check file now- ' + ss.getUrl();

  
  if(col === 2 |col === 1) {
    MailApp.sendEmail(Toemail,subject, body);
 }

};
1
  • While it is a nice gesture that you share the code that does what you are looking for, it's not clear how this answers the question and how it should be used. There is also no mention of the trigger that should be used to call this code. Oct 10, 2023 at 20:28

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