title: Google Script to copy formula to Value and only on new data entry
body: <p>I have a spreadsheet linked to a Google Form, once the form is completed a formula pulls in some weather information from OpenWeatherMap.org. To keep the weather information from that date/time I created a script that copies the formula to a value.</p>
  
  <p>I would like a script that does this, but only runs on new data, leaving previous cells alone.
  For example, if A1 copied data to values in B1, and new data from the Form populates A2, then the script would ignore A1&amp;B1 and copy A2 in to B2.</p>
  
  <p>The code below was provided to me, It has two functions, it has not worked how I would like.</p>
  
  <pre><code>function moveValuesOnly1() {
    var ss=SpreadsheetApp.getActive();
    var sh=ss.getSheetByName('Sheet1');
    var srg=sh.getRange(1,2,sh.getLastRow(),6);
    var vA=srg.getValues();
    sh.getRange(getLastRowOfRange("H:M")+1,8,srg.getHeight(),srg.getWidth()).setValues(vA);
  }
  
  
  function getLastRowOfRange(A1Range) {
    var A1Range=A1Range||"H:M";//default for debugging
    var ss=SpreadsheetApp.getSheetByName('Sheet1');
    var sh=ss.getActiveSheet();
    var rg=sh.getRange(A1Range);
    var vA=rg.getValues();
    for(var i=vA.length-1;i&gt;-1;i--) {
      if(vA[i].join("").length==0) {
        vA.splice(i,1);
      }
    }
    Logger.log(vA.length);
    return vA.length;
  }
  </code></pre>
  
  <p>As I mentioned earlier, if A1 copied data to values in B1, and new data from the Form populates A2, then the script would ignore A1&amp;B1 and copy A2 in to B2.</p>