Reputation: 111
I'm tryin to read in a column of cells its numbers and backgrounng colors ,and copy it to another columuns.
I can read both and put values in arrays, so what I need is pass the values in these arrays to the range that should receive it.
That's what I'm trying, reading values in column A and pass it to column C:
var origin =["A1:A5"]
var destiny=["C1:C5"]
var ColCell = SpreadsheetApp.getActiveSpreadsheet().getRange(origin).getBackgrounds();
var ValCell=SpreadsheetApp.getActiveSheet().getRange(origin).getValues();
// now i have two arrays, ColCell and ValCell,
// that have backgound colors and Values of original
// cells in the range "A1:A5".
I can't figure how to pass values in ColCell
and ValCell
to ["C1:C5"]. Have anyone had this problem before?
Upvotes: 1
Views: 187
Reputation: 201613
If my understanding is correct, how about this modification?
var origin = ["A1:A5"];
var destiny = ["C1:C5"];
// Retrieve values.
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange(origin);
var ColCell = range.getBackgrounds();
var ValCell = range.getValues();
// Set values.
sheet.getRange(destiny).setBackgrounds(ColCell).setValues(ValCell);
If I misunderstood your question and this was not the result you want, I apologize.
Upvotes: 1