I am trying to have Sheets iterate through the data range, and start another function if two conditions are met. If the other function is started I want a cell to have the value set. If the function is not started, it would continue iterating through and increasing the value of i each time.
const ss = SpreadsheetApp.getActiveSpreadsheet()
const ws = ss.getSheetByName("Repairs")
var rows = ws.getDataRange().getValues();
rows.forEach(function(eachRow) {
var i = 1
var p = 4
if (eachRow[3].includes("Complete") && (!eachRow[4].includes("Posted"))) {
var currentMessage = eachRow[0] + "\n" + eachRow[1] + "\n" + eachRow[2]
RepairsCompleted(currentMessage)
var cell = ws.getRange(i,4);
cell.setValue("Posted");
}
i++
});
}```