google sheets script - select multiple a1 notation range -


i'm opting batch update of row colors using google apps script. cannot go usual range function, rows colored not consecutive. thought, a1 notation helpful unfortunately looks can pass 1 range of a1 notation , not multiple:

var a1notations="a1:c1,a3:c3,a10,c10"; sheet.getrange(a1notations).setbackground("red"); 

but i'm getting "range not found" error.

any ideas how can make work?

thanks!

put range notations array, loop through array:

function setmultiranges() {   var ss = spreadsheetapp.getactivespreadsheet();   var sh = ss.getactivesheet();    var a1notations=["a1:c1","a3:c3","a10","c10"];    var i=0,       arrylngth = a1notations.length;    (i=0;i<arrylngth;i+=1) {     //logger.log(a1notations[i]);     //logger.log(typeof a1notations[i]);      sh.getrange(a1notations[i]).setbackground("red");   }; }; 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -