title: Unexpected behavior of a function using getMaxRows() method
body: <p>I've built this function to insert a dropdown list in blank rows. It was invoked each time the sheet was edited. But, instead of only inserting the lists in the blank rows, the function added thousands of new rows (with the dropdownlists). Any tip why this happened?</p>
  <pre><code>function insertDropdownList(){
      var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); 
      var lastRow = sheet.getLastRow();        
      var range = sheet.getRange(lastRow+1, getColumnNrByName(sheet, &quot;COLUMN NMAE&quot;)+1, sheet.getMaxRows());
      var rule = SpreadsheetApp.newDataValidation().requireValueInList(['value 1', 'value2'], true).build();
      range.setDataValidation(rule);
  }
  </code></pre>