Trying to apply what I've learned but having trouble

I am trying to have Google Sheets send an email when column 5 contains the exact string “Yes”. If I personally trigger the script, it works just fine but I want it to automatically trigger on edit but it does not work for some reason. Please excuse the sloppiness of my script. I have rewritten several times and am still fairly new to Javascript. Thanks for any help!!

function ifStatemenet(){
var sheet = SpreadsheetApp.getActiveSheet();
var row = sheet.getDataRange();
var numRows = row.getNumRows();
var values = row.getValues();
for(i in values){
var row = values[i];
if (row[4] == “Yes”) {

sendEmail();

}
}
}

function sendEmail(){
var sheet = SpreadsheetApp.getActiveSheet();

var row = sheet.getDataRange();
var values = row.getValues();
var row = values[i];
var recipient = row[1,1];
var subject = “Internal Repair Form”;
var body = row[1,5];
MailApp.sendEmail(recipient, subject, body)

};

Hi there,

I’m hoping we can take a few steps back as I have no idea what you’re doing.

First, I want to make sure that the function name ifStatemenet isn’t a misspelling of ifStatement. It could be that whatever you’re doing is expecting this particular function, and that would certainly prevent it from working.

Second, while I can definitely help with the JavaScript (as can many others here), it would help to be able to see the full project. Is there a way you could post a read-only version of the spreadsheet for us to see? Do you have this in a GitHub repo? Being able to see the full context of the code can help us help you.

Third, what do you mean by “personally trigger” and “automatically trigger”?