I want to make a little script that copies all line values obtained by a formula, to that same line without the formula.
I’m trying to use copyValuesToRange on the same line. (I would get the values calculated on a certain line and I would overlap them with those same values, fomula free).
A little contextualization… I’m doing a kind of record/pre-vision of values for a game. On the same sheet I have past records, the today’s record and values that are still to happen.
To obtain those values the sheet performs a few calculations per line but i want it only to calculate values that havent happened yet. So, each day, the sheet should perform an operation that clears the formulas from the previous day. For this i tried doing the following:
function example(oRow){
var app = SpreadsheetApp.getActiveSpreadsheet();
var sheetRecord = app.getSheetByName("Record");
sheetRecord.getRange(oRow-1,1,1,18)
.copyValuesToRange(sheetRecord,1,18,oRow-1,oRow-1);
}
oRow is the row number of the line that i want this operation to occur.
This is either doing nothing or still copying the formulas to the same cells.
I’m sure it’s some stupid litte thing that I’m missing, but i can’t put my finger on it.
How can i fix this? Or is there a simpler way to do this?
Thank you in advance.
The arguments of the functions getRange() and copyValuesToRange() i showed above on the question are missplaced.
The functionas are:
So if I want to copy the values of the, for example, row 9 from column 1 to 15 (“A9:P9”) to that same row, i would have to do the following:
instead of what’s above on the question.