title: getLastRow() affecting other cells
body: <p>Hello I am currently working on a time tracking system. With the following code I track the time how long a value was in a cell. This time is recorded in another worksheet and this is done continuously by appendRow ().</p>
  <pre><code>function onEdit(e) {
    addTimestamp(e);
  }
  
  function addTimestamp(e) {
    var ui = SpreadsheetApp.getUi();
    var ws = &quot;Tabellenblatt2&quot;;
    var ss = e.source;
    var targetSheet = ss.getSheetByName(&quot;Tabellenblatt1&quot;);
    var range = targetSheet.getRange(3, 2, 1000, 1);
    var currentDate = new Date();
    var scriptProperties = PropertiesService.getScriptProperties();
    if (e.source.getActiveSheet().getName() === ws) {
      var cell = ss.getActiveCell();
      var val = cell.getValue();
      var sourceRowIndex = cell.getRow();
      if (val != &quot;&quot;) {
        let rowToAdd = [val, &quot;&quot;, currentDate, &quot;&quot;]
        targetSheet.appendRow(rowToAdd);
        scriptProperties.setProperty(sourceRowIndex, targetSheet.getLastRow());
      } else {
        var rowIndex = Number(scriptProperties.getProperty(sourceRowIndex));
        if (rowIndex) targetSheet.getRange(rowIndex, 4).setValue(currentDate);
      }
    }
  }
  
  </code></pre>
  <p>Now one Picture to show my Problem:
  <a href="https://i.stack.imgur.com/T04U8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T04U8.png" alt="enter image description here" /></a></p>
  <p>The problem is that the cells should start in row 1, is that possible with getLastRow ()?</p>