retter
retter

Reputation: 23

Automatic Email by Status in Google Sheets

The following code has an error with line 7, var sheet = ss.getSheetByName(“Active Projects”);

This code is being used to send email when project is completed.

function checkValue(e) {
  var ss = SpreadsheetApp.getActive();

  var sheet = ss.getSheetByName(“Active Projects”);

  var valueToCheck = sheet.getRange(“E”).getValue();

  var rangeEdit = e.range.getA1Notation();

  if (rangeEdit == “E”)

  {

    if (valueToCheck = Completed)

    {

      MailApp.sendEmail(“0000 @gmail.com”, “blah”, “test” + valueToCheck + “.”);

    }

  }

}

Upvotes: 0

Views: 45

Answers (1)

Leftium
Leftium

Reputation: 17903

Try changing the smart quotes (“”) to normal quotes (""):

function checkValue(e) {
  var ss = SpreadsheetApp.getActive();

  var sheet = ss.getSheetByName("Active Projects");

  var valueToCheck = sheet.getRange("E").getValue();

  var rangeEdit = e.range.getA1Notation();

  if (rangeEdit == "E")

  {

    if (valueToCheck = Completed)

    {

      MailApp.sendEmail("0000 @gmail.com", "blah", "test" + valueToCheck + ".");

    }

  }

}

Upvotes: 1

Related Questions