I'm currently trying to copy a range of cells from Spreadsheet A to Spreadsheet B. In this range I have a combination of values and formulas which I'm trying to bring across.
I've tried using the .copyTo method with:
SpreadsheetA.getRange("A:E").copyTo(SpreadsheetB.getRange("A:E"), {contentsOnly:true});
But this errors as .copyto will only work within the same spreadsheet and not if they're separate. I've also tried using .setValues() and .setFormulas() but they seem to overwrite each other if one is used after another. I need a function such as below:
CopyData(SourceSpreadsheet, DestinationSpreadsheet, SourceRange, DestinationRange)
Which will copy both formulas and values depending on what they are. Thanks so much in advance if anyone has an example! You'll be a lifesaver.
I've also tried using .setValues() and .setFormulas() but they seem to overwrite each other if one is used after another.. I apologize for my poor English skill. Can I ask you about the detail of it? - Tanaike