title: How to overwrite cell function with Paste value only using Google Script
body: <p>I have a database that makes live calculations, but once the new data added to the database has been processed that day, I effectively want to Copy + Paste value only on these cells so that the results of the formulas are fixed and can no longer change.</p>
  <p>The current script I am using is:</p>
  <pre><code>function myFunction() {
    var sh = SpreadsheetApp.getActiveSpreadsheet();
    var ss = sh.getActiveSheet();
    var r = ss.getRange(1,2,ss.getLastRow());
    var vals = r.getValues();
    for(var i =0;i&lt;vals.length;i++){
        ss.getRange(i+1,2).setValue(ss.getRange(i+1,2).getValue());
    }
  }
  </code></pre>
  <p>However, in column B beneath the data set, all the cells start with IF(B2092=&quot;&quot;,&quot;&quot;,etc). On cells that are empty, I still require the formula to remain in place. I only want to script to be applied to cells that have data within.</p>
  <p>Can anyone help with this? Thanks</p>