I need a google sheet script function that copy in my cell the result of a formula in another cell.
I need the cell to get the first result and then become independent from the other cell because the formula result can become N/D but I need the second cell to keep the value.
0
votes
1 Answers
0
votes
You can copy the output of the formula in another given cell: Here an example:
/**
* The column B hosts the formulas and the column A hosts the output
*/
function myFunction() {
let ss = SpreadsheetApp.getActiveSheet();
ss.getRange("A1").setValue(ss.getRange("B1").getValue());
}
Edit:
To copy a range use .setValues() and .getValues() functions:
function myFunction() {
let ss = SpreadsheetApp.getActiveSheet();
ss.getRange("A1:A").setValues(ss.getRange("B1:B").getValues());
}