title: Copy Values from One Column to Another in Google Scripts
body: <p>I have a data table that pulls its information from a series of VLOOKUPs in google sheets. I am constantly editing the source which changes my data table. I need a google scripts code that would copy the cells that have been affected by the formulas to another column that would not be affected. I tried copying everything at once to move over but the second time it was activated, the now blank cells overwrote the formerly I was able to successfully do this task with VBA, but I cannot figure out the transition. Here is it what I have so far:</p>
  
  <pre><code>function CopyCells() {
  
  var sheet2 = SpreadsheetApp.getActive().getSheetByName('Records');
  var loc = sheet2.getRange("C2:C126").getValues();
  var taget_sheet = sheet2.getRange("D2:D126");
  for(i = 1;i == "Present";i++){ i.copyTo("target_sheet")}       
  }
  </code></pre>
  
  <p>My VBA Code:</p>
  
  <pre><code> Dim ColERange As Range
   Dim ColFRange As Range 
   Set ColERange = Range("E1:E100") 
   Set ColFRange = Range("F1:F100") 
   Dim Cell As Range 
   For Each Cell In ColERange 
     If Cell.Value = "Present" 
       Then Cell.Offset(0, 1).Value = Cell.Value 
     ElseIf Cell.Value = "Absent" 
       Then Cell.Offset(0, 1).Value = Cell.Value 
     ElseIf Cell.Value = "" 
       Then Cell.Offset(0, 1).Value = Cell.Value 
     End If 
   Next Cell   
  </code></pre>