In Google Sheets, I am trying to delete an entire row when one cell in that row contains the phrase "Delivered." The onEdit function won't work for my needs because it requires me to manually make an edit to the sheet before it works - which is not what I want. I need it to delete rows automatically [in real time] because the word "Delivered" is being generated from a live web query {=index(IMPORTXML} (shipment tracking if you haven't guessed).
Here is the formula I had using onEdit before I realized it wasn't what I needed:
function onEdit(event) {
var s = SpreadsheetApp.getActiveSpreadsheet();
var r = SpreadsheetApp.getActiveRange();
// getColumn with "Delivered" is currently set to column 9 or I.
if(r.getColumn() == 9 && r.getValue() == "Delivered") {
var row = r.getRow();
s.deleteRow(row);
}
}
The formula is designed to delete to an entire row based on the word "Delivered" in column 9, or "I". Would onFormSubmit work for my needs, or onChange? If so, how would I structure the formula?