So I'm working on a script to search my Google Sheet for a value and then delete the row, so far I have this:
function sort() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues();
var rowsDeleted = 0;
for (var i = 0; i <= numRows - 1; i++) {
var row = values[i];
if (row[0] == 'test') {
sheet.deleteRow((parseInt(i)+1) - rowsDeleted); rowsDeleted++;
}
}
};
So what I got so far is that I can exact match the text, but I want to find all cols which contains "test" and not only "test". So it will delete rows with data like:
- This is a test
- Test me again
- ThisTestIsNotWorking
Any solution :)?