Send email if value meet criteria in column

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 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];
    
asked by anonymous 14.06.2018 / 06:47

1 answer

1

Your = operator is incorrect. The = sign is of assignment, you must use == to check equality:

if (lembretePeriodico == "sim") {
    
14.06.2018 / 06:54