title: Google Script return date when range is edited
body: <p>I'm currently working on a script for a spreadsheet.</p>
  
  <p>Desired Behavior: When cells F-I are edited, the date of the most recent edit should be returned in cell L of the corresponding row.</p>
  
  <p>I've found two samples of code, the first returns the date in cell L when ANY field in the row is edited. This behavior is acceptable, but not ideal as it applies to any col</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>function onEdit() {
   var s = SpreadsheetApp.getActiveSheet();
   var r = s.getActiveCell();
   if( r.getColumn() != 2 ) {
     var row = r.getRow();
     var time = new Date();
     time = Utilities.formatDate(time, "GMT-05:00", "yyyy-MM-dd");
     SpreadsheetApp.getActiveSheet().getRange('L'+row.toString()).setValue(time);
    };
   };
  </code></pre>
  
  <p>The second should return the date one cell to the right of the edited column. This behavior is not desired as it may overwrite other important data.</p>
  
  <pre class="lang-js prettyprint-override"><code>function onEdit(e) {
  var s = SpreadsheetApp.getActiveSheet();
  var cols = [1, 7, 13, 19, 25, 31]
  if (s.getName() !== "Sheet1" || cols.indexOf(e.range.columnStart) == -1) return;
  s.getRange(e.range.rowStart, e.range.columnStart + 1)
      .setValue(new Date());
  };
  </code></pre>
  
  <p>Any help or advice on editing these to behave more closely to the desired results would be much appreciated. Thanks!</p>