I have been searching for days on how to do this. I have tried 12 different scripts so far. I can copy over but not the formatting, it is killing me. I have two sheets. Sheet A and Sheet B.
I want to copy over columns A through I onto sheet B And keep the formatting. I have 2 problems the first is It copies everything instead of just the columns I want. The second is it does not keep the formatting. I have tried different scripts just for formatting and different lines of code. but so far none have worked for me.
Current Script:
function CopyDataToNewFile() {
var sss = SpreadsheetApp.openById('16QcYsC3mbdcYiPsCp7tPFPX-pCePkaITzfF-bK4ceu0'); // sss = source spreadsheet
var ss = sss.getSheetByName('Sheet1'); // ss = source sheet
var SRange = ss.getDataRange();
var A1Range = SRange.getA1Notation();
var SData = SRange.getValues();
var tss = SpreadsheetApp.openById('16OBwPrYmKnZZkgovDDUYByJhssU2nbRkBD0hCrgvYK4'); // tss = target spreadsheet
var ts = tss.getSheetByName('Sheet1'); // ts = target sheet
ts.clear({contentsOnly: true});
ts.getRange(A1Range).setValues(SData);
}
getDataRange(),getRange(),copyFormatToRange(),copyTo()- tehhowch