1

I haven't found a solution on this yet. I have a result spreadsheet from a formula on which I have to delete some rows from time to time. I am using this:

function readRows() {
  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[9] > 1) {
      sheet.deleteRow((parseInt(i) + 1) - rowsDeleted);
      rowsDeleted++;
    }
  }
};

The issue here is that google form doesn't decrease the counter and I only have found a solution where you can set the form counter to 0. I don't want the formula to continue on row x though I deleted some rows before. Is there a solution to this?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
wurzeldd
  • 57
  • 1
  • 5
  • Your question isn't very clear - is the problem that some rows you want deleted are being left? (If so, try looping backwards: `for (var i=numRows-1; i >= 0; i--) ...`) – Mogsdad Nov 26 '14 at 01:46

0 Answers0