I'd like to copy and paste just values and format - not formula..
E.G (A1 is a dynamic text):
A1 = "test"
A2 = =A1
I'd like to use a script that when activated it copy A2 format and text (in this case would copy "test" - not "=a1") to A3 .
I tried with "formatOnly:true , contentsOnly:true" - but it keep copying formula.
function Threebrow() {
var sheet2 = SpreadsheetApp.getActive().getSheetByName('c');
sheet2.getRange("a2").copyTo(sheet2.getRange(sheet2.getLastRow()+1,1,1,7), {formatOnly:true , contentsOnly:true});
}
Formulas are also counted as content in this context. The below function copies value and format of A2 to the lowest row in the first column.
function Threebrow() {
var sheet2 = SpreadsheetApp.getActive().getSheetByName('c');
var sourceRange = sheet2.getRange("a2");
var targetRange = sheet2.getRange(sheet2.getLastRow()+1,1,1,1);
targetRange.setValues(sourceRange.getValues());
sourceRange.copyTo(targetRange, {formatOnly:true})
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With