0

I'm trying to have my sheet trigger an email alert when the last row on certain column matches an if statement after a google form feeds the sheet. it worked the first time but when i try to do a second condition it only acomplishes the second if. so separated the ifs work, but not combined.

can you guys help? here is the function:

function sendEmails() {
  
  var ss  = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Observaciones Diarias IMPRG");
  var lr  = ss.getLastRow();
  
  var currentTemp = ss.getRange(lr, 6).getValue();
  var currentkidName = ss.getRange(lr, 3).getValue();
  var currentTexture = ss.getRange(lr, 15).getValue();
  
  if(currentTemp >39) {
  
  MailApp.sendEmail("xxx25@gmail.com","Temperature>39°Alert", currentkidName + " had atemperature of " + currentTemp + "° " +" which is extremely high, please check")
  }
  
  else if (currentTexture = 1){
    MailApp.sendEmail("xxx@gmail.com","Texture Alert", currentkidName + " had a  " + " liquid Evacuation. which indicates an issue, please check")
  }
}

1 Answers1

0

currentTexture = 1 this is asigning a 1 to currentTexture. To do a comparison use

currentTexture == 1

or

currentTexture === 1

Related

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Rubén
  • 34,714
  • 9
  • 70
  • 166