This is the code :
var values = [[ ph, sd, sg, qz, str ]];
var Rangeisi = shtdb.getRangeList(['C3:C6','C9']);
if(id="id001"){Rangeisi.setValues(values);
return }
And this is the result :
TypeError: Rangeisi.setValues is not a function
But when I use this code :
var values = [[ ph, sd, sg, qz, str ]];
var Rangeisi = shtdb.getRange(['A1:E1']);
if(id="id001"){Rangeisi.setValues(values);
return }
It works!
My question is: how to select range (C3,C4,C5,C6,C9) to set values [ ph, sd, sg, qz, str ]
?
2
Answers
There is no
setValues()
method of aRangeList
onlysetValue()
which set each cell in the range to the same value.The following example shows how to use a range list but it is limited to your specific example shown in your question. It would probably need to be modifed for different
RangeList
.Since the first range in the range list is C3:C6 i construct a 2D array of those value. And since the last range in the range list is on C9 I still construct a 2D array of that value to use the
setValues()
method ofRange
. I wrap both of those in an array to match the number of ranges in the range list.Reference:
Or simply this: