I have this rangelist as the destination and a row of values that should be written to the destination.
I was thinking of iterating through the row of data and also through th rangelist and set value along the way, but I can’t find a way to iterate through the elements in the row of data.
Here’s the piece of code I’m working on:
let data = [];
for (let i = 0; i < values.length; i++) {
if (values[i][0] == ref && values[i][4] == variac) {
data.push(values[i])
}
}
const destRng = [
"B5", "D5", "G5", "I5", "M5",
"B7", "H7",
"B9",
"C12", "C14", "C16", "C18", "C20", "C22", "C24",
"B27", "E27", "H27", "L27",
"B29",
"B32", "E32", "H32", "L32",
"B34", "E34", "H34", "L34",
"B36", "E36",
"B40", "F40", "J40",
"B42",
"B44", "F44", "J44",
"B46", "F46", "J46",
"B48", "F48", "J48",
"B50",
"D53",
"D55",
"B58", "D58", "G58", "I58", "L58",
"B61", "E61", "G61", "J61",
"B65", "G65"
]
Logger.log('Data: ' + data)
const rngList = sheetCadProd.getRangeList(destRng).getRanges();
for (let n = 0; n < data.length; n++) {
for (let i = 0; i < rngList.length; i++) {
let dado = data[n]
rngList[i].setValue(dado)//It sets the first value throughout the rngList
}
}
}
Now, this is getting the first element of data and writing it to all destination cells. How can I go through these data elements?
Thank you!