I’ve done a lengthy search and couldn’t find what I’m looking for. Maybe someone out there can kindly help?
I have a Google Apps Script that deletes rows from a spreadsheet that contain ‘Hello’ in column D.
function deleteRow() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getSheetByName('Sheet1');
var values = s.getDataRange().getValues();
for( var row = values.length -1; row >= 0; --row )
if (values[row][3] == 'Hello')
s.deleteRow(parseInt(row)+1);
};
However, I need a script that only deletes one row – the lowest row with ‘Hello’ in column D.
Also, a similar script that deletes the highest row with ‘Hello’ in column D.
Does anyone know how to achieve this? Your valuable help will be highly appreciated.
The first column is the timestamp (the data is from a form), so if the script could delete the oldest row containing ‘Hello’ in column D, that would also do just fine! (And similarly a script for the deleting the most recent row with ‘hello’ in column D).
Its actually pretty simple. Just break out as soon as you hit the highest or lowest row (I’m assuming row 1 is high and row 10 is low).