Koşullu biçimlendirme kuralları için oluşturucu.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain a number between 1 and 10. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenNumberBetween(1, 10) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Yöntemler
Yöntem | Dönüş türü | Kısa açıklama |
---|---|---|
build() | Conditional | Oluşturucuya uygulanan ayarlardan koşullu biçim kuralı oluşturur. |
copy() | Conditional | Bu kuralın ayarlarını içeren bir kural oluşturucu hazır ayarı döndürür. |
get | Boolean | Bu kural, boole koşulu ölçütleri kullanıyorsa kuralın Boolean bilgilerini alır. |
get | Gradient | Bu kural, gradyan koşulu ölçütlerini kullanıyorsa kuralın Gradient bilgilerini alır. |
get | Range[] | Bu koşullu biçimlendirme kuralının uygulandığı aralıkları alır. |
set | Conditional | Koşullu biçim kuralının biçimi için arka plan rengini ayarlar. |
set | Conditional | Koşullu biçim kuralının biçimi için arka plan rengini ayarlar. |
set | Conditional | Koşullu biçimlendirme kuralının biçimi için metin kalınlaştırmayı ayarlar. |
set | Conditional | Koşullu biçim kuralının biçimi için yazı tipi rengini ayarlar. |
set | Conditional | Koşullu biçim kuralının biçimi için yazı tipi rengini ayarlar. |
set | Conditional | Koşullu biçimlendirme kuralının gradyan maksimum nokta değerini temizler ve bunun yerine kuralın aralıklarındaki maksimum değeri kullanır. |
set | Conditional | Koşullu biçimlendirme kuralının gradyan maksimum nokta değerini temizler ve bunun yerine kuralın aralıklarındaki maksimum değeri kullanır. |
set | Conditional | Koşullu biçim kuralının gradyan maksimum nokta alanlarını ayarlar. |
set | Conditional | Koşullu biçim kuralının gradyan maksimum nokta alanlarını ayarlar. |
set | Conditional | Koşullu biçim kuralının gradyan orta nokta alanlarını ayarlar. |
set | Conditional | Koşullu biçim kuralının gradyan orta nokta alanlarını ayarlar. |
set | Conditional | Koşullu biçim kuralının gradyan minimum nokta değerini temizler ve bunun yerine kuralın aralıklarındaki minimum değeri kullanır. |
set | Conditional | Koşullu biçim kuralının gradyan minimum nokta değerini temizler ve bunun yerine kuralın aralıklarındaki minimum değeri kullanır. |
set | Conditional | Koşullu biçim kuralının gradyan minimum nokta alanlarını ayarlar. |
set | Conditional | Koşullu biçim kuralının gradyan minimum nokta alanlarını ayarlar. |
set | Conditional | Koşullu biçim kuralının biçimi için metni italik yapar. |
set | Conditional | Bu koşullu biçim kuralının uygulandığı bir veya daha fazla aralığı ayarlar. |
set | Conditional | Koşullu biçimlendirme kuralının biçimi için metnin üzerini çizme özelliğini ayarlar. |
set | Conditional | Koşullu biçimlendirme kuralının biçimi için metin altı çizgisini ayarlar. |
when | Conditional | Hücre boş olduğunda tetiklenecek koşullu biçim kuralını ayarlar. |
when | Conditional | Koşullu biçim kuralını, hücre boş olmadığında tetiklenecek şekilde ayarlar. |
when | Conditional | Koşullu biçim kuralını, bir tarih belirli bir değerden sonra olduğunda tetiklenecek şekilde ayarlar. |
when | Conditional | Koşullu biçim kuralını, bir tarih belirtilen göreli tarihten sonra olduğunda tetiklenecek şekilde ayarlar. |
when | Conditional | Koşullu biçim kuralını, bir tarih belirtilen tarihten önce olduğunda tetiklenecek şekilde ayarlar. |
when | Conditional | Koşullu biçim kuralını, bir tarih belirtilen göreli tarihten önce olduğunda tetiklenecek şekilde ayarlar. |
when | Conditional | Bir tarih, belirtilen tarihe eşit olduğunda tetiklenecek koşullu biçim kuralını ayarlar. |
when | Conditional | Bir tarih, belirtilen göreli tarihe eşit olduğunda tetiklenecek koşullu biçim kuralını ayarlar. |
when | Conditional | Belirtilen formül true olarak değerlendirildiğinde tetiklenecek koşullu biçim kuralını ayarlar. |
when | Conditional | Koşullu biçimlendirme kuralını, bir sayı iki belirtilen değer arasında olduğunda veya bu değerlerden biri olduğunda tetiklenecek şekilde ayarlar. |
when | Conditional | Bir sayı, verilen değere eşit olduğunda tetiklenecek koşullu biçim kuralını ayarlar. |
when | Conditional | Bir sayı, verilen değerden büyük olduğunda tetiklenecek koşullu biçim kuralını ayarlar. |
when | Conditional | Koşullu biçimlendirme kuralını, bir sayı belirli bir değerden büyük veya bu değere eşit olduğunda tetiklenecek şekilde ayarlar. |
when | Conditional | Koşullu biçim kuralını, verilen değerden küçük bir sayı olduğunda tetiklenecek şekilde ayarlar. |
when | Conditional | Koşullu biçim kuralını, verilen değerden küçük veya bu değere eşit bir sayı olduğunda tetiklenecek şekilde ayarlar. |
when | Conditional | Bir sayı belirtilen iki değer arasında olmadığında ve bu değerlerden biri olmadığında tetiklenecek koşullu biçimlendirme kuralını ayarlar. |
when | Conditional | Bir sayı, verilen değere eşit olmadığında tetiklenecek koşullu biçim kuralını ayarlar. |
when | Conditional | Girişin belirli bir değeri içermesi durumunda tetiklenecek koşullu biçim kuralını ayarlar. |
when | Conditional | Giriş, belirtilen değeri içermediğinde tetiklenecek koşullu biçim kuralını ayarlar. |
when | Conditional | Giriş, belirli bir değerle bittiğinde tetiklenecek koşullu biçim kuralını ayarlar. |
when | Conditional | Giriş, belirli bir değere eşit olduğunda tetiklenecek koşullu biçim kuralını ayarlar. |
when | Conditional | Giriş, belirli bir değerle başladığında tetiklenecek koşullu biçim kuralını ayarlar. |
with | Conditional | Koşullu biçim kuralını, Boolean değerleri tarafından tanımlanan ölçütlere ayarlar. Bu değerler genellikle mevcut bir kuralın criteria ve arguments değerlerinden alınır. |
Ayrıntılı belgeler
build()
Oluşturucuya uygulanan ayarlardan koşullu biçim kuralı oluşturur.
Return
Conditional
: Koşullu biçim kuralının gösterimi.
copy()
Bu kuralın ayarlarını içeren bir kural oluşturucu hazır ayarı döndürür.
Return
Conditional
: Bu kuralın ayarlarına dayalı bir oluşturucu.
get Boolean Condition()
Bu kural, boole koşulu ölçütleri kullanıyorsa kuralın Boolean
bilgilerini alır. Aksi takdirde null
değerini döndürür.
// Log the boolean criteria type of the first conditional format rules of a // sheet. const rule = SpreadsheetApp.getActiveSheet().getConditionalFormatRules()[0]; const booleanCondition = rule.getBooleanCondition(); if (booleanCondition != null) { Logger.log(booleanCondition.getCriteriaType()); }
Return
Boolean
: Boole koşulu nesnesi veya kuralda Boole koşulu kullanılmıyorsa null
.
get Gradient Condition()
Bu kural, gradyan koşulu ölçütlerini kullanıyorsa kuralın Gradient
bilgilerini alır. Aksi takdirde null
değerini döndürür.
// Log the gradient minimum color of the first conditional format rule of a // sheet. const rule = SpreadsheetApp.getActiveSheet().getConditionalFormatRules()[0]; const gradientCondition = rule.getGradientCondition(); if (gradientCondition != null) { // Assume the color has ColorType.RGB. Logger.log(gradientCondition.getMinColorObject().asRgbColor().asHexString()); }
Return
Gradient
: Gradyan koşul nesnesi veya kuralda gradyan koşulu kullanılmıyorsa null
.
get Ranges()
Bu koşullu biçimlendirme kuralının uygulandığı aralıkları alır.
// Log each range of the first conditional format rule of a sheet. const rule = SpreadsheetApp.getActiveSheet().getConditionalFormatRules()[0]; const ranges = rule.getRanges(); for (let i = 0; i < ranges.length; i++) { Logger.log(ranges[i].getA1Notation()); }
Return
Range[]
: Bu koşullu biçim kuralının uygulandığı aralıklar.
set Background(color)
Koşullu biçim kuralının biçimi için arka plan rengini ayarlar. null
iletildiğinde kuraldan arka plan rengi biçimlendirme ayarı kaldırılır.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color to red if the cell has text equal to "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextEqualTo('hello') .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | String | İstenen renk veya null simgesiyle temizleyin. |
Return
Conditional
— Zincirleme için oluşturucu.
set Background Object(color)
Koşullu biçim kuralının biçimi için arka plan rengini ayarlar. null
iletildiğinde kuraldan arka plan rengi biçimlendirme ayarı kaldırılır.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color to theme background color if the cell has text // equal to "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const color = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.BACKGROUND) .build(); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextEqualTo('hello') .setBackground(color) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | Color | İstenen renk nesnesi veya null simgesiyle temizleyin. |
Return
Conditional
— Zincirleme için oluşturucu.
set Bold(bold)
Koşullu biçimlendirme kuralının biçimi için metin kalınlaştırmayı ayarlar. bold
true
ise koşul karşılandığında kural metni kalınlaştırır. false
ise koşul karşılandığında kural, mevcut kalınlaştırmaları kaldırır. null
değerinin iletilmesi, kuraldaki kalın biçimlendirme ayarını kaldırır.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn their text bold if the cell has text equal to "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextEqualTo('hello') .setBold(true) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
bold | Boolean | Biçim koşulu karşılandığında metnin kalınlaştırılıp kalınlaştırılmayacağı; null bu ayarı kaldırır. |
Return
Conditional
— Zincirleme için oluşturucu.
set Font Color(color)
Koşullu biçim kuralının biçimi için yazı tipi rengini ayarlar. null
iletildiğinde kuraldan yazı tipi rengi biçim ayarı kaldırılır.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their font color to red if the cell has text equal to "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextEqualTo('hello') .setFontColor('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | String | İstenen renk veya null simgesiyle temizleyin. |
Return
Conditional
— Zincirleme için oluşturucu.
set Font Color Object(color)
Koşullu biçim kuralının biçimi için yazı tipi rengini ayarlar. null
iletildiğinde kuraldan yazı tipi rengi biçim ayarı kaldırılır.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their font color to theme text color if the cell has text equal to // "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const color = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.TEXT) .build(); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextEqualTo('hello') .setFontColor(color) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | Color | İstenen renk nesnesi veya null simgesiyle temizleyin. |
Return
Conditional
— Zincirleme için oluşturucu.
set Gradient Maxpoint(color)
Koşullu biçimlendirme kuralının gradyan maksimum nokta değerini temizler ve bunun yerine kuralın aralıklarındaki maksimum değeri kullanır. Ayrıca, gradyanın maksimum nokta rengini giriş rengi olarak ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color somewhere between white and red, based on their // values in comparison to the ranges minimum and maximum values. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .setGradientMaxpoint('#FF0000') .setGradientMinpoint('#FFFFFF') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | String | Ayarlanacak maksimum nokta rengi. |
Return
Conditional
— Zincirleme için oluşturucu.
set Gradient Maxpoint Object(color)
Koşullu biçimlendirme kuralının gradyan maksimum nokta değerini temizler ve bunun yerine kuralın aralıklarındaki maksimum değeri kullanır. Ayrıca, gradyanın maksimum nokta rengini giriş rengi olarak ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color somewhere between theme text and background // colors, based on their values in comparison to the ranges minimum and maximum // values. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const textColor = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.TEXT) .build(); const backgroundColor = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.BACKGROUND) .build(); const rule = SpreadsheetApp.newConditionalFormatRule() .setGradientMaxpoint(textColor) .setGradientMinpoint(backgroundColor) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | Color | Ayarlanacak maksimum nokta rengi nesnesi. |
Return
Conditional
— Zincirleme için oluşturucu.
set Gradient Maxpoint Object With Value(color, type, value)
Koşullu biçim kuralının gradyan maksimum nokta alanlarını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color somewhere from theme accent 1, accent 2 to accent // 3 colors, based on their values in comparison to the values 0, 50, and 100. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const color1 = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT1) .build(); const color2 = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT2) .build(); const color3 = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT3) .build(); const rule = SpreadsheetApp.newConditionalFormatRule() .setGradientMaxpointWithValue( color1, SpreadsheetApp.InterpolationType.NUMBER, '100', ) .setGradientMidpointWithValue( color2, SpreadsheetApp.InterpolationType.NUMBER, '50', ) .setGradientMinpointWithValue( color3, SpreadsheetApp.InterpolationType.NUMBER, '0', ) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | Color | Ayarlanacak maksimum nokta rengi. |
type | Interpolation | Ayarlanacak maksimum nokta enterpolasyon türü. |
value | String | Ayarlanacak maksimum nokta değeri. |
Return
Conditional
— Zincirleme için oluşturucu.
set Gradient Maxpoint With Value(color, type, value)
Koşullu biçim kuralının gradyan maksimum nokta alanlarını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color somewhere from red green to blue, based on their // values in comparison to the values 0, 50, and 100. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .setGradientMaxpointWithValue( '#0000FF', SpreadsheetApp.InterpolationType.NUMBER, '100', ) .setGradientMidpointWithValue( '#00FF00', SpreadsheetApp.InterpolationType.NUMBER, '50', ) .setGradientMinpointWithValue( '#FF0000', SpreadsheetApp.InterpolationType.NUMBER, '0', ) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | String | Ayarlanacak maksimum nokta rengi. |
type | Interpolation | Ayarlanacak maksimum nokta enterpolasyon türü. |
value | String | Ayarlanacak maksimum nokta değeri. |
Return
Conditional
— Zincirleme için oluşturucu.
set Gradient Midpoint Object With Value(color, type, value)
Koşullu biçim kuralının gradyan orta nokta alanlarını ayarlar. Geçirilen enterpolasyon türü null
ise tüm orta nokta alanlarını temizler.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color somewhere from theme accent 1 to accent 2 to // accent 3 colors, based on their values in comparison to the values 0, 50, and // 100. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const color1 = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT1) .build(); const color2 = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT2) .build(); const color3 = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT3) .build(); const rule = SpreadsheetApp.newConditionalFormatRule() .setGradientMaxpointWithValue( color1, SpreadsheetApp.InterpolationType.NUMBER, '100', ) .setGradientMidpointWithValue( color2, SpreadsheetApp.InterpolationType.NUMBER, '50', ) .setGradientMinpointWithValue( color3, SpreadsheetApp.InterpolationType.NUMBER, '0', ) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | Color | Ayarlanacak orta nokta rengi. |
type | Interpolation | Ayarlanacak orta nokta enterpolasyon türü veya temizlenecek null . |
value | String | Ayarlanacak orta nokta değeri. |
Return
Conditional
— Zincirleme için oluşturucu.
set Gradient Midpoint With Value(color, type, value)
Koşullu biçim kuralının gradyan orta nokta alanlarını ayarlar. Geçirilen enterpolasyon türü null
ise tüm orta nokta alanlarını temizler.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color somewhere from red green to blue, based on their // values in comparison to the values 0, 50, and 100. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .setGradientMaxpointWithValue( '#0000FF', SpreadsheetApp.InterpolationType.NUMBER, '100', ) .setGradientMidpointWithValue( '#00FF00', SpreadsheetApp.InterpolationType.NUMBER, '50', ) .setGradientMinpointWithValue( '#FF0000', SpreadsheetApp.InterpolationType.NUMBER, '0', ) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | String | Ayarlanacak orta nokta rengi. |
type | Interpolation | Ayarlanacak orta nokta enterpolasyon türü veya temizlenecek null . |
value | String | Ayarlanacak orta nokta değeri. |
Return
Conditional
— Zincirleme için oluşturucu.
set Gradient Minpoint(color)
Koşullu biçim kuralının gradyan minimum nokta değerini temizler ve bunun yerine kuralın aralıklarındaki minimum değeri kullanır. Ayrıca, gradyanın minimum nokta rengini giriş rengine ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color somewhere between white and red, based on their // values in comparison to the ranges minimum and maximum values. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .setGradientMaxpoint('#FF0000') .setGradientMinpoint('#FFFFFF') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | String | Ayarlanacak minimum nokta rengi. |
Return
Conditional
— Zincirleme için oluşturucu.
set Gradient Minpoint Object(color)
Koşullu biçim kuralının gradyan minimum nokta değerini temizler ve bunun yerine kuralın aralıklarındaki minimum değeri kullanır. Ayrıca, gradyanın minimum nokta rengini giriş rengine ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color somewhere between theme text and background // colors, based on their values in comparison to the ranges minimum and maximum // values. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const textColor = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.TEXT) .build(); const backgroundColor = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.BACKGROUND) .build(); const rule = SpreadsheetApp.newConditionalFormatRule() .setGradientMaxpoint(textColor) .setGradientMinpoint(backgroundColor) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | Color | Ayarlanacak minimum nokta rengi nesnesi. |
Return
Conditional
— Zincirleme için oluşturucu.
set Gradient Minpoint Object With Value(color, type, value)
Koşullu biçim kuralının gradyan minimum nokta alanlarını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color somewhere from theme accent 1 to accent 2 to // accent 3 colors, based on their values in comparison to the values 0, 50, and // 100. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const color1 = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT1) .build(); const color2 = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT2) .build(); const color3 = SpreadsheetApp.newColor() .setThemeColor(SpreadsheetApp.ThemeColorType.ACCENT3) .build(); const rule = SpreadsheetApp.newConditionalFormatRule() .setGradientMaxpointWithValue( color1, SpreadsheetApp.InterpolationType.NUMBER, '100', ) .setGradientMidpointWithValue( color2, SpreadsheetApp.InterpolationType.NUMBER, '50', ) .setGradientMinpointWithValue( color3, SpreadsheetApp.InterpolationType.NUMBER, '0', ) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | Color | Ayarlanacak minimum nokta rengi. |
type | Interpolation | Ayarlanacak minpoint enterpolasyon türü. |
value | String | Ayarlanacak minimum nokta değeri. |
Return
Conditional
— Zincirleme için oluşturucu.
set Gradient Minpoint With Value(color, type, value)
Koşullu biçim kuralının gradyan minimum nokta alanlarını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // set their background color somewhere from red to green to blue, based on // their values in comparison to the values 0, 50, and 100. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .setGradientMaxpointWithValue( '#0000FF', SpreadsheetApp.InterpolationType.NUMBER, '100', ) .setGradientMidpointWithValue( '#00FF00', SpreadsheetApp.InterpolationType.NUMBER, '50', ) .setGradientMinpointWithValue( '#FF0000', SpreadsheetApp.InterpolationType.NUMBER, '0', ) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
color | String | Ayarlanacak minimum nokta rengi. |
type | Interpolation | Ayarlanacak minpoint enterpolasyon türü. |
value | String | Ayarlanacak minimum nokta değeri. |
Return
Conditional
— Zincirleme için oluşturucu.
set Italic(italic)
Koşullu biçim kuralının biçimi için metni italik yapar. italic
, true
ise koşul karşılandığında kural metni italik yapar. false
ise koşul karşılandığında kural, mevcut italik biçimlendirmeyi kaldırır. null
iletildiğinde kuraldaki italik biçim ayarı kaldırılır.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn their text italic if the cell has text equal to "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextEqualTo('hello') .setItalic(true) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
italic | Boolean | Biçim koşulu karşılandığında metnin italik yapılıp yapılmayacağı;
null bu ayarı kaldırır. |
Return
Conditional
— Zincirleme için oluşturucu.
set Ranges(ranges)
Bu koşullu biçim kuralının uygulandığı bir veya daha fazla aralığı ayarlar. Bu işlem, mevcut aralıkları değiştirir. Boş bir dizi ayarlamak, mevcut aralıkları temizler. Bir kuralda en az bir aralık olmalıdır.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 // and range D4:F6 to turn red if they contain a number between 1 and 10. const sheet = SpreadsheetApp.getActiveSheet(); const rangeOne = sheet.getRange('A1:B3'); const rangeTwo = sheet.getRange('D4:F6'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenNumberBetween(1, 10) .setBackground('#FF0000') .setRanges([rangeOne, rangeTwo]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
ranges | Range[] | Bu koşullu biçim kuralının uygulandığı aralıklar. |
Return
Conditional
— Zincirleme için oluşturucu.
set Strikethrough(strikethrough)
Koşullu biçimlendirme kuralının biçimi için metnin üzerini çizme özelliğini ayarlar. strikethrough
true
ise koşul karşılandığında kural metnin üzerini çizer. false
ise koşul karşılandığında kural, mevcut üstü çizili biçimlendirmeyi kaldırır. null
değerini iletmek, kuraldaki üstü çizili biçim ayarını kaldırır.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // strikethrough their text if the cell has text equal to "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextEqualTo('hello') .setStrikethrough(true) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
strikethrough | Boolean | Biçim koşulu karşılanırsa metnin üstünün çizilip çizilmeyeceği; null bu ayarı kaldırır. |
Return
Conditional
— Zincirleme için oluşturucu.
set Underline(underline)
Koşullu biçimlendirme kuralının biçimi için metin altı çizgisini ayarlar. underline
true
ise koşul karşılandığında kural metnin altını çizer. false
ise koşul karşılandığında kural mevcut alt çizgileri kaldırır. null
değerini iletmek, kuraldan alt çizgi biçimlendirme ayarını kaldırır.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // underline their text if the cell has text equal to "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextEqualTo('hello') .setUnderline(true) .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
underline | Boolean | Biçim koşulu karşılandığında metnin altının çizilip çizilmeyeceği;
null bu ayarı kaldırır. |
Return
Conditional
— Zincirleme için oluşturucu.
when Cell Empty()
Hücre boş olduğunda tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they are empty. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenCellEmpty() .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Return
Conditional
— Zincirleme için oluşturucu.
when Cell Not Empty()
Koşullu biçim kuralını, hücre boş olmadığında tetiklenecek şekilde ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they are not empty. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenCellNotEmpty() .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Return
Conditional
— Zincirleme için oluşturucu.
when Date After(date)
Koşullu biçim kuralını, bir tarih belirli bir değerden sonra olduğunda tetiklenecek şekilde ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain a date after 11/4/1993. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenDateAfter(new Date('11/4/1993')) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
date | Date | En son tarih. |
Return
Conditional
— Zincirleme için oluşturucu.
when Date After(date)
Koşullu biçim kuralını, bir tarih belirtilen göreli tarihten sonra olduğunda tetiklenecek şekilde ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain a date after today. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenDateAfter(SpreadsheetApp.RelativeDate.TODAY) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
date | Relative | Seçilen tarih türüne göre en son tarih. |
Return
Conditional
— Zincirleme için oluşturucu.
when Date Before(date)
Koşullu biçim kuralını, bir tarih belirtilen tarihten önce olduğunda tetiklenecek şekilde ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain a date before 11/4/1993. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenDateBefore(new Date('11/4/1993')) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
date | Date | Kabul edilemeyecek en erken tarih. |
Return
Conditional
— Zincirleme için oluşturucu.
when Date Before(date)
Koşullu biçim kuralını, bir tarih belirtilen göreli tarihten önce olduğunda tetiklenecek şekilde ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain a date before today. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenDateBefore(SpreadsheetApp.RelativeDate.TODAY) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
date | Relative | Seçilen tarih türüne göre en son tarih. |
Return
Conditional
— Zincirleme için oluşturucu.
when Date Equal To(date)
Bir tarih, belirtilen tarihe eşit olduğunda tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain the date 11/4/1993. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenDateEqualTo(new Date('11/4/1993')) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
date | Date | Tek kabul edilebilir tarih. |
Return
Conditional
— Zincirleme için oluşturucu.
when Date Equal To(date)
Bir tarih, belirtilen göreli tarihe eşit olduğunda tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain todays date. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenDateEqualTo(SpreadsheetApp.RelativeDate.TODAY) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
date | Relative | Seçilen tarih türüne göre en son tarih. |
Return
Conditional
— Zincirleme için oluşturucu.
when Formula Satisfied(formula)
Belirtilen formül true
olarak değerlendirildiğinde tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they satisfy the condition "=EQ(B4, C3)". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenFormulaSatisfied('=EQ(B4, C3)') .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
formula | String | Giriş geçerliyse true olarak değerlendirilen özel bir formül. |
Return
Conditional
— Zincirleme için oluşturucu.
when Number Between(start, end)
Koşullu biçimlendirme kuralını, bir sayı iki belirtilen değer arasında olduğunda veya bu değerlerden biri olduğunda tetiklenecek şekilde ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain a number between 1 and 10. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenNumberBetween(1, 10) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
start | Number | Kabul edilebilir en düşük değer. |
end | Number | Kabul edilebilir en yüksek değer. |
Return
Conditional
— Zincirleme için oluşturucu.
when Number Equal To(number)
Bir sayı, verilen değere eşit olduğunda tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain the number 10. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenNumberEqualTo(10) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
number | Number | Kabul edilebilir tek değer. |
Return
Conditional
— Zincirleme için oluşturucu.
when Number Greater Than(number)
Bir sayı, verilen değerden büyük olduğunda tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain a number greater than 10. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenNumberGreaterThan(10) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
number | Number | Kabul edilemeyen en yüksek değer. |
Return
Conditional
— Zincirleme için oluşturucu.
when Number Greater Than Or Equal To(number)
Koşullu biçimlendirme kuralını, bir sayı belirli bir değerden büyük veya bu değere eşit olduğunda tetiklenecek şekilde ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain a number greater than or equal to 10. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenNumberGreaterThanOrEqualTo(10) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
number | Number | Kabul edilebilir en düşük değer. |
Return
Conditional
— Zincirleme için oluşturucu.
when Number Less Than(number)
Koşullu biçim kuralını, verilen değerden küçük bir sayı olduğunda tetiklenecek şekilde ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain a number less than 10. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenNumberLessThan(10) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
number | Number | Kabul edilemeyecek en düşük değer. |
Return
Conditional
— Zincirleme için oluşturucu.
when Number Less Than Or Equal To(number)
Koşullu biçim kuralını, verilen değerden küçük veya bu değere eşit bir sayı olduğunda tetiklenecek şekilde ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain a number less than or equal to 10. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenNumberLessThanOrEqualTo(10) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
number | Number | Kabul edilebilir en yüksek değer. |
Return
Conditional
— Zincirleme için oluşturucu.
when Number Not Between(start, end)
Bir sayı belirtilen iki değer arasında olmadığında ve bu değerlerden biri olmadığında tetiklenecek koşullu biçimlendirme kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain a number not between 1 and 10. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenNumberNotBetween(1, 10) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
start | Number | Kabul edilemeyecek en düşük değer. |
end | Number | Kabul edilemeyen en yüksek değer. |
Return
Conditional
— Zincirleme için oluşturucu.
when Number Not Equal To(number)
Bir sayı, verilen değere eşit olmadığında tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they don't contain the number 10. const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenNumberNotEqualTo(10) .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
number | Number | Tek kabul edilemez değer. |
Return
Conditional
— Zincirleme için oluşturucu.
when Text Contains(text)
Girişin belirli bir değeri içermesi durumunda tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they contain the text "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextContains('hello') .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
text | String | Girişin içermesi gereken değer. |
Return
Conditional
— Zincirleme için oluşturucu.
when Text Does Not Contain(text)
Giriş, belirtilen değeri içermediğinde tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they don't contain the text "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextDoesNotContain('hello') .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
text | String | Girişin içermemesi gereken değer. |
Return
Conditional
— Zincirleme için oluşturucu.
when Text Ends With(text)
Giriş, belirli bir değerle bittiğinde tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they end with the text "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextEndsWith('hello') .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
text | String | Dizenin sonuyla karşılaştırılacak metin. |
Return
Conditional
— Zincirleme için oluşturucu.
when Text Equal To(text)
Giriş, belirli bir değere eşit olduğunda tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they have text equal to "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextEqualTo('hello') .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
text | String | Kabul edilebilir tek değer. |
Return
Conditional
— Zincirleme için oluşturucu.
when Text Starts With(text)
Giriş, belirli bir değerle başladığında tetiklenecek koşullu biçim kuralını ayarlar.
// Adds a conditional format rule to a sheet that causes cells in range A1:B3 to // turn red if they start with the text "hello". const sheet = SpreadsheetApp.getActiveSheet(); const range = sheet.getRange('A1:B3'); const rule = SpreadsheetApp.newConditionalFormatRule() .whenTextStartsWith('hello') .setBackground('#FF0000') .setRanges([range]) .build(); const rules = sheet.getConditionalFormatRules(); rules.push(rule); sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
text | String | Dizenin başlangıcıyla karşılaştırılacak metin. |
Return
Conditional
— Zincirleme için oluşturucu.
with Criteria(criteria, args)
Koşullu biçim kuralını, Boolean
değerleri tarafından tanımlanan ölçütlere ayarlar. Bu değerler genellikle mevcut bir kuralın criteria
ve arguments
değerlerinden alınır.
// Adds a new conditional format rule that is a copy of the first active // conditional format rule, except it instead sets its cells to have a black // background color. const sheet = SpreadsheetApp.getActiveSheet(); const rules = sheet.getConditionalFormatRules(); const booleanCondition = rules[0].getBooleanCondition(); if (booleanCondition != null) { const rule = SpreadsheetApp.newConditionalFormatRule() .withCriteria( booleanCondition.getCriteriaType(), booleanCondition.getCriteriaValues(), ) .setBackground('#000000') .setRanges(rules[0].getRanges()) .build(); rules.push(rule); } sheet.setConditionalFormatRules(rules);
Parametreler
Ad | Tür | Açıklama |
---|---|---|
criteria | Boolean | Koşullu biçim ölçütlerinin türü. |
args | Object[] | Ölçüt türüne uygun bir dizi bağımsız değişken. Bağımsız değişkenlerin sayısı ve türü, yukarıdaki ilgili when...() yöntemiyle eşleşir. |
Return
Conditional
— Zincirleme için oluşturucu.