title: Speed up App Script code for deleting rows
body: <p>I have a sheet with two columns. in the first one there is a date and in the second one there might be a text. I want to delete all rows where the date is in the past or the second column is empty.</p>
  <pre><code>for (var row = lastRow; row &gt;= 1; row--) {
    if (sheet.getRange(row, 1).getValue() &lt; today || sheet.getRange(row, 2).getValue() == &quot;&quot;) {
       sheet.deleteRow(row);
    }
  }
  </code></pre>
  <p>This code is very slow because it has to access every cell. But I currently can't think of a better way... But there should be one.</p>
  <p>Thanks in advance for any suggestion.</p>
  <p>Luisa</p>