Google sheets 基于值和其他单元格的NewConditionalFormature
我正在尝试使用应用程序脚本Google sheets 基于值和其他单元格的NewConditionalFormature,google-sheets,google-sheets-api,spreadsheet,Google Sheets,Google Sheets Api,Spreadsheet,我正在尝试使用应用程序脚本newConditionalFormatRule根据其他单元格设置单元格的颜色 假设我有: A1 = 40 B1 = 90 然后我想A1得到绿色,因为它比B1低。 我想B1变成红色,因为它比A1高 有没有办法让我在rulset中创建这种行为 比如: 此示例创建一个条件格式规则,该规则为范围内的值设置从绿色到红色的颜色渐变。最低值为绿色,最高值为红色 function CFtest2() { var theSheet = SpreadsheetApp.getActi
newConditionalFormatRule
根据其他单元格设置单元格的颜色
假设我有:
A1 = 40
B1 = 90
然后我想A1得到绿色,因为它比B1低。
我想B1变成红色,因为它比A1高
有没有办法让我在rulset中创建这种行为
比如:
此示例创建一个条件格式规则,该规则为范围内的值设置从绿色到红色的颜色渐变。最低值为绿色,最高值为红色
function CFtest2() {
var theSheet = SpreadsheetApp.getActive();
var area = theSheet.getRange('A1:B1');
var newRule = SpreadsheetApp.newConditionalFormatRule();
newRule
.setRanges([area])
.setGradientMinpoint('#00FF00')
.setGradientMidpointWithValue('#FFFFFF', SpreadsheetApp.InterpolationType.PERCENTILE, '50')
.setGradientMaxpoint('#FF0000')
.build();
theSheet.getActiveSheet().setConditionalFormatRules([newRule]);
};
此示例创建一个条件格式规则,该规则为范围内的值设置从绿色到红色的颜色渐变。最低值为绿色,最高值为红色
function CFtest2() {
var theSheet = SpreadsheetApp.getActive();
var area = theSheet.getRange('A1:B1');
var newRule = SpreadsheetApp.newConditionalFormatRule();
newRule
.setRanges([area])
.setGradientMinpoint('#00FF00')
.setGradientMidpointWithValue('#FFFFFF', SpreadsheetApp.InterpolationType.PERCENTILE, '50')
.setGradientMaxpoint('#FF0000')
.build();
theSheet.getActiveSheet().setConditionalFormatRules([newRule]);
};