Google 应用脚本根据相对于每个 cellRange 的 1 个单元格引用为多个 cellRange 提供相同的条件格式
Google App Script give multiple cellRange same conditional format based on 1 cell reference relative to each cellRange
我正在编写一个脚本,根据每组的第一个单元格为每组单元格设置条件格式。
For(i=0,i<10,i++)
/*
other part of the script
*/.whenFormulaSatisfied('=INDEX(A1)<0,5')
我想使用不同于 A1notation 的符号而不是 A1。
我需要 A1 在每个循环之后变成 C1,然后是 E1,然后是 G1 等等。
提前致谢
.whenFormulaSatisfied(`=INDEX(${String.fromCharCode(65+i)}1)<0,5`)
65 是大写字母的起始代码和 A
的代码。所以这应该可以达到 Z
。如果您需要超过 Z
,请参阅 this answer
您也可以使用getA1Notation()
for (var i = 0; i<10; i+=2){
var cellNotation = sh.getRange(1,i+1).getA1Notation();
console.log(cellNotation)
}
结果
3:59:01 PM Info A1
3:59:01 PM Info C1
3:59:01 PM Info E1
3:59:01 PM Info G1
3:59:01 PM Info I1
我正在编写一个脚本,根据每组的第一个单元格为每组单元格设置条件格式。
For(i=0,i<10,i++)
/*
other part of the script
*/.whenFormulaSatisfied('=INDEX(A1)<0,5')
我想使用不同于 A1notation 的符号而不是 A1。 我需要 A1 在每个循环之后变成 C1,然后是 E1,然后是 G1 等等。
提前致谢
.whenFormulaSatisfied(`=INDEX(${String.fromCharCode(65+i)}1)<0,5`)
65 是大写字母的起始代码和 A
的代码。所以这应该可以达到 Z
。如果您需要超过 Z
,请参阅 this answer
您也可以使用getA1Notation()
for (var i = 0; i<10; i+=2){
var cellNotation = sh.getRange(1,i+1).getA1Notation();
console.log(cellNotation)
}
结果
3:59:01 PM Info A1
3:59:01 PM Info C1
3:59:01 PM Info E1
3:59:01 PM Info G1
3:59:01 PM Info I1