Send email if value meet a criterion in the column

Asked

Viewed 22 times

1

I have a code that reads a "yes" value in a column and sends an email if that value is there. However, the if that I created for this sends even if the value "yes" is not there. The code is below. My if seems to be correct.

for (var i=0;i<numRows-startRow;i++){
    var lembretePeriodico = dataRange[i][10]; 

    if (lembretePeriodico  = "sim") {
      var emailAddress = dataRange[i][7] + ", " + dataRange[i][1] + ", " + dataRange[i][9];

1 answer

1

Your operator = is incorrect. The signal = is attribution, you must use == to verify equality:

if (lembretePeriodico == "sim") {

Browser other questions tagged

You are not signed in. Login or sign up in order to post.