I'm working on a sheet that will get data transferred from one sheet to another. I've manipulated another script I've found and it's working pretty well. Until I need to get some cells as Values, and some as Formulas.
I need Col A-Col D as "getValues" I need Col E-Col Q as "getFormulas"
Here's the formula that was working:
function Copy(){
var origSheetObject = SpreadsheetApp.openById('Key1').getSheetByName('Daily Log');
var destSheetObject = SpreadsheetApp.openById('Key2').getSheetByName('Imported Data');
var origLastCol = origSheetObject.getLastColumn();
var arrOrigData = origSheetObject.getRange (6, 1, 1, 17).getFormulas();
var destlastRow = destSheetObject.getLastRow()+1;
var cont;
for (cont = 0; cont <origLastCol; cont++)
destSheetObject.getRange(destlastRow, 1+cont).setValue(arrOrigData[0][cont]);
I know If I were to change the getFormula to getValue I get just values and not the formulas I need to see. Here is what I've tried but it's not correct:
function Copy(){
var origSheetObject = SpreadsheetApp.openById('Key1').getSheetByName('Daily Log');
var destSheetObject = SpreadsheetApp.openById('Key2').getSheetByName('Imported Data');
var origLastCol = origSheetObject.getLastColumn();
var arrOrigData = origSheetObject.getRange (6, 1, 1, 4).getValues();
origSheetObject.getRange (6, 5, 1, 13).getFormulas();
var destlastRow = destSheetObject.getLastRow()+1;
var cont;
for (cont = 0; cont <origLastCol; cont++)
destSheetObject.getRange(destlastRow, 1+cont).setValue(arrOrigData[0][cont]);
I'm not sure how to get it to let me pull values and formulas along the same row. Any suggestions would be awesome!