I am looking to delete rows that have a zero in column E in a particular row range. I have the following script, which will delete the rows with a zero in column E but this seems to apply to the whole spreadsheet.
{
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[4] == 0 || row[4] == '') {
sheet.deleteRow((parseInt(i)+1) - rowsDeleted);
rowsDeleted++;
}
}
I am looking for help in applying this to a range, such as row 10 through row 20 rather than the entire spreadsheet.