So I have a code that removes rows from the spreadsheet that contain specific words. How can I apply it not only to one column and search for only one word but to check several columns and several words?
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[21].indexOf('Wohnmobil') > -1) {
sheet.deleteRow((parseInt(i)+1) - rowsDeleted); rowsDeleted++;
}
}
};
With this code it looks through column V and removes rows with word "Wohnmobil".
How to make it check columns R and V for example and remove rows that contain words like "Wohnmobil", "WG", "Trailer", "Caravan"?