Builder untuk aturan format bersyarat.
// 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);
Metode
Metode | Jenis hasil yang ditampilkan | Deskripsi singkat |
---|---|---|
build() | Conditional | Membuat aturan format bersyarat dari setelan yang diterapkan ke builder. |
copy() | Conditional | Menampilkan preset pembuat aturan dengan setelan aturan ini. |
get | Boolean | Mengambil informasi Boolean aturan jika aturan ini menggunakan kriteria kondisi boolean. |
get | Gradient | Mengambil informasi Gradient aturan, jika aturan ini menggunakan kriteria kondisi gradien. |
get | Range[] | Mengambil rentang tempat aturan format bersyarat ini diterapkan. |
set | Conditional | Menetapkan warna latar belakang untuk format aturan format bersyarat. |
set | Conditional | Menetapkan warna latar belakang untuk format aturan format bersyarat. |
set | Conditional | Menetapkan penebalan teks untuk format aturan format bersyarat. |
set | Conditional | Menetapkan warna font untuk format aturan format bersyarat. |
set | Conditional | Menetapkan warna font untuk format aturan format bersyarat. |
set | Conditional | Menghapus nilai titik maksimum gradien aturan format bersyarat, dan sebagai gantinya menggunakan nilai maksimum dalam rentang aturan. |
set | Conditional | Menghapus nilai titik maksimum gradien aturan format bersyarat, dan sebagai gantinya menggunakan nilai maksimum dalam rentang aturan. |
set | Conditional | Menetapkan kolom titik maksimum gradien aturan format bersyarat. |
set | Conditional | Menetapkan kolom titik maksimum gradien aturan format bersyarat. |
set | Conditional | Menetapkan kolom titik tengah gradien aturan format bersyarat. |
set | Conditional | Menetapkan kolom titik tengah gradien aturan format bersyarat. |
set | Conditional | Menghapus nilai titik minimum gradien aturan format bersyarat, dan sebagai gantinya menggunakan nilai minimum dalam rentang aturan. |
set | Conditional | Menghapus nilai titik minimum gradien aturan format bersyarat, dan sebagai gantinya menggunakan nilai minimum dalam rentang aturan. |
set | Conditional | Menetapkan kolom titik minimum gradien aturan format bersyarat. |
set | Conditional | Menetapkan kolom titik minimum gradien aturan format bersyarat. |
set | Conditional | Menetapkan teks miring untuk format aturan format bersyarat. |
set | Conditional | Menetapkan satu atau beberapa rentang tempat aturan format bersyarat ini diterapkan. |
set | Conditional | Menetapkan teks coret untuk format aturan format bersyarat. |
set | Conditional | Menetapkan garis bawah teks untuk format aturan format bersyarat. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat sel kosong. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat sel tidak kosong. |
when | Conditional | Menetapkan aturan format bersyarat agar dipicu saat tanggal setelah nilai yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat agar dipicu saat tanggal setelah tanggal relatif yang ditentukan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat tanggal sebelum tanggal yang ditentukan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat tanggal sebelum tanggal relatif yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat tanggal sama dengan tanggal yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat tanggal sama dengan tanggal relatif yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat yang akan dipicu saat formula yang diberikan dievaluasi menjadi true . |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat angka berada di antara, atau salah satu dari, dua nilai yang ditentukan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat angka sama dengan nilai yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat angka lebih besar dari nilai yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat angka lebih besar dari atau sama dengan nilai yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat angka kurang dari nilai yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat angka kurang dari atau sama dengan nilai yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat angka tidak berada di antara, dan tidak sama dengan, dua nilai yang ditentukan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat angka tidak sama dengan nilai yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat input berisi nilai yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat input tidak berisi nilai yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat input berakhir dengan nilai yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat input sama dengan nilai yang diberikan. |
when | Conditional | Menetapkan aturan format bersyarat untuk dipicu saat input dimulai dengan nilai yang diberikan. |
with | Conditional | Menetapkan aturan format bersyarat ke kriteria yang ditentukan oleh nilai Boolean , biasanya diambil dari criteria dan arguments dari aturan yang ada. |
Dokumentasi mendetail
build()
Membuat aturan format bersyarat dari setelan yang diterapkan ke builder.
Pulang pergi
Conditional
— Representasi aturan format bersyarat.
copy()
Menampilkan preset pembuat aturan dengan setelan aturan ini.
Pulang pergi
Conditional
— Builder berdasarkan setelan aturan ini.
get Boolean Condition()
Mengambil informasi Boolean
aturan jika aturan ini menggunakan kriteria kondisi boolean. Jika tidak, akan menampilkan null
.
// 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()); }
Pulang pergi
Boolean
— Objek kondisi boolean, atau null
jika aturan tidak menggunakan kondisi boolean.
get Gradient Condition()
Mengambil informasi Gradient
aturan, jika aturan ini menggunakan kriteria kondisi gradien. Jika tidak, akan menampilkan null
.
// 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()); }
Pulang pergi
Gradient
— Objek kondisi gradien, atau null
jika aturan tidak menggunakan kondisi gradien.
get Ranges()
Mengambil rentang tempat aturan format bersyarat ini diterapkan.
// 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()); }
Pulang pergi
Range[]
— Rentang tempat aturan format bersyarat ini diterapkan.
set Background(color)
Menetapkan warna latar belakang untuk format aturan format bersyarat. Meneruskan null
menghapus setelan format warna latar belakang dari aturan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | String | Warna yang diinginkan atau null untuk menghapus. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Background Object(color)
Menetapkan warna latar belakang untuk format aturan format bersyarat. Meneruskan null
menghapus setelan format warna latar belakang dari aturan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | Color | Objek warna yang diinginkan atau null untuk menghapus. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Bold(bold)
Menetapkan penebalan teks untuk format aturan format bersyarat. Jika bold
adalah true
, aturan akan menebalkan teks jika kondisi terpenuhi; jika false
, aturan akan menghapus penebalan yang ada jika kondisi terpenuhi. Menyertakan null
akan menghapus setelan format tebal dari aturan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
bold | Boolean | Apakah teks harus dicetak tebal jika kondisi format terpenuhi; null menghapus setelan ini. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Font Color(color)
Menetapkan warna font untuk format aturan format bersyarat. Meneruskan null
akan menghapus setelan format warna font dari aturan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | String | Warna yang diinginkan atau null untuk menghapus. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Font Color Object(color)
Menetapkan warna font untuk format aturan format bersyarat. Meneruskan null
akan menghapus setelan format warna font dari aturan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | Color | Objek warna yang diinginkan atau null untuk menghapus. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Gradient Maxpoint(color)
Menghapus nilai titik maksimum gradien aturan format bersyarat, dan sebagai gantinya menggunakan nilai maksimum dalam rentang aturan. Juga menetapkan warna titik maksimum gradien ke warna input.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | String | Warna titik maksimum yang akan ditetapkan. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Gradient Maxpoint Object(color)
Menghapus nilai titik maksimum gradien aturan format bersyarat, dan sebagai gantinya menggunakan nilai maksimum dalam rentang aturan. Juga menetapkan warna titik maksimum gradien ke warna input.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | Color | Objek warna titik maksimum yang akan ditetapkan. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Gradient Maxpoint Object With Value(color, type, value)
Menetapkan kolom titik maksimum gradien aturan format bersyarat.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | Color | Warna titik maksimum yang akan ditetapkan. |
type | Interpolation | Jenis interpolasi maxpoint yang akan ditetapkan. |
value | String | Nilai maxpoint yang akan ditetapkan. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Gradient Maxpoint With Value(color, type, value)
Menetapkan kolom titik maksimum gradien aturan format bersyarat.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | String | Warna titik maksimum yang akan ditetapkan. |
type | Interpolation | Jenis interpolasi maxpoint yang akan ditetapkan. |
value | String | Nilai maxpoint yang akan ditetapkan. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Gradient Midpoint Object With Value(color, type, value)
Menetapkan kolom titik tengah gradien aturan format bersyarat. Menghapus semua kolom titik tengah jika jenis interpolasi yang diteruskan adalah null
.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | Color | Warna titik tengah yang akan ditetapkan. |
type | Interpolation | Jenis interpolasi titik tengah yang akan ditetapkan atau null yang akan dihapus. |
value | String | Nilai titik tengah yang akan ditetapkan. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Gradient Midpoint With Value(color, type, value)
Menetapkan kolom titik tengah gradien aturan format bersyarat. Menghapus semua kolom titik tengah jika jenis interpolasi yang diteruskan adalah null
.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | String | Warna titik tengah yang akan ditetapkan. |
type | Interpolation | Jenis interpolasi titik tengah yang akan ditetapkan atau null yang akan dihapus. |
value | String | Nilai titik tengah yang akan ditetapkan. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Gradient Minpoint(color)
Menghapus nilai titik minimum gradien aturan format bersyarat, dan sebagai gantinya menggunakan nilai minimum dalam rentang aturan. Juga menetapkan warna titik minimum gradien ke warna input.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | String | Warna titik minimum yang akan ditetapkan. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Gradient Minpoint Object(color)
Menghapus nilai titik minimum gradien aturan format bersyarat, dan sebagai gantinya menggunakan nilai minimum dalam rentang aturan. Juga menetapkan warna titik minimum gradien ke warna input.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | Color | Objek warna titik minimum yang akan ditetapkan. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Gradient Minpoint Object With Value(color, type, value)
Menetapkan kolom titik minimum gradien aturan format bersyarat.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | Color | Warna titik minimum yang akan ditetapkan. |
type | Interpolation | Jenis interpolasi minpoint yang akan ditetapkan. |
value | String | Nilai minpoint yang akan ditetapkan. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Gradient Minpoint With Value(color, type, value)
Menetapkan kolom titik minimum gradien aturan format bersyarat.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
color | String | Warna titik minimum yang akan ditetapkan. |
type | Interpolation | Jenis interpolasi minpoint yang akan ditetapkan. |
value | String | Nilai minpoint yang akan ditetapkan. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Italic(italic)
Menetapkan teks miring untuk format aturan format bersyarat. Jika italic
adalah true
, aturan akan memiringkan teks jika kondisi terpenuhi; jika false
, aturan akan menghapus pemiringan yang ada jika kondisi terpenuhi. Meneruskan null
akan menghapus setelan format miring dari aturan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
italic | Boolean | Apakah teks harus dimiringkan jika kondisi format terpenuhi; null menghapus setelan ini. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Ranges(ranges)
Menetapkan satu atau beberapa rentang tempat aturan format bersyarat ini diterapkan. Operasi ini menggantikan rentang yang ada. Menetapkan array kosong akan menghapus rentang yang ada. Aturan harus memiliki minimal satu rentang.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
ranges | Range[] | Rentang tempat aturan format bersyarat ini diterapkan. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Strikethrough(strikethrough)
Menetapkan teks coret untuk format aturan format bersyarat. Jika strikethrough
adalah true
, aturan akan mencoret teks jika kondisi terpenuhi; jika false
, aturan akan menghapus format coretan yang ada jika kondisi terpenuhi. Menyertakan null
akan menghapus setelan format coret dari aturan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
strikethrough | Boolean | Apakah teks harus dicoret jika kondisi format terpenuhi; null menghapus setelan ini. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
set Underline(underline)
Menetapkan garis bawah teks untuk format aturan format bersyarat. Jika underline
adalah true
, aturan akan menggarisbawahi teks jika kondisi terpenuhi; jika false
, aturan akan menghapus garis bawah yang ada jika kondisi terpenuhi. Meneruskan null
akan menghapus setelan format garis bawah dari aturan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
underline | Boolean | Apakah teks harus digarisbawahi jika kondisi format terpenuhi; null menghapus setelan ini. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Cell Empty()
Menetapkan aturan format bersyarat untuk dipicu saat sel kosong.
// 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);
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Cell Not Empty()
Menetapkan aturan format bersyarat untuk dipicu saat sel tidak kosong.
// 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);
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Date After(date)
Menetapkan aturan format bersyarat agar dipicu saat tanggal setelah nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
date | Date | Tanggal terbaru. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Date After(date)
Menetapkan aturan format bersyarat agar dipicu saat tanggal setelah tanggal relatif yang ditentukan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
date | Relative | Tanggal terbaru yang relatif terhadap jenis tanggal yang dipilih. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Date Before(date)
Menetapkan aturan format bersyarat untuk dipicu saat tanggal sebelum tanggal yang ditentukan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
date | Date | Tanggal paling awal yang tidak dapat diterima. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Date Before(date)
Menetapkan aturan format bersyarat untuk dipicu saat tanggal sebelum tanggal relatif yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
date | Relative | Tanggal terbaru yang relatif terhadap jenis tanggal yang dipilih. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Date Equal To(date)
Menetapkan aturan format bersyarat untuk dipicu saat tanggal sama dengan tanggal yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
date | Date | Satu-satunya tanggal yang dapat diterima. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Date Equal To(date)
Menetapkan aturan format bersyarat untuk dipicu saat tanggal sama dengan tanggal relatif yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
date | Relative | Tanggal terbaru yang relatif terhadap jenis tanggal yang dipilih. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Formula Satisfied(formula)
Menetapkan aturan format bersyarat yang akan dipicu saat formula yang diberikan dievaluasi menjadi true
.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
formula | String | Formula kustom yang dievaluasi ke true jika input valid. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Number Between(start, end)
Menetapkan aturan format bersyarat untuk dipicu saat angka berada di antara, atau salah satu dari, dua nilai yang ditentukan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
start | Number | Nilai terendah yang dapat diterima. |
end | Number | Nilai tertinggi yang dapat diterima. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Number Equal To(number)
Menetapkan aturan format bersyarat untuk dipicu saat angka sama dengan nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
number | Number | Satu-satunya nilai yang dapat diterima. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Number Greater Than(number)
Menetapkan aturan format bersyarat untuk dipicu saat angka lebih besar dari nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
number | Number | Nilai tertinggi yang tidak dapat diterima. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Number Greater Than Or Equal To(number)
Menetapkan aturan format bersyarat untuk dipicu saat angka lebih besar dari atau sama dengan nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
number | Number | Nilai terendah yang dapat diterima. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Number Less Than(number)
Menetapkan aturan format bersyarat untuk dipicu saat angka kurang dari nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
number | Number | Nilai terendah yang tidak dapat diterima. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Number Less Than Or Equal To(number)
Menetapkan aturan format bersyarat untuk dipicu saat angka kurang dari atau sama dengan nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
number | Number | Nilai tertinggi yang dapat diterima. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Number Not Between(start, end)
Menetapkan aturan format bersyarat untuk dipicu saat angka tidak berada di antara, dan tidak sama dengan, dua nilai yang ditentukan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
start | Number | Nilai terendah yang tidak dapat diterima. |
end | Number | Nilai tertinggi yang tidak dapat diterima. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Number Not Equal To(number)
Menetapkan aturan format bersyarat untuk dipicu saat angka tidak sama dengan nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
number | Number | Satu-satunya nilai yang tidak dapat diterima. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Text Contains(text)
Menetapkan aturan format bersyarat untuk dipicu saat input berisi nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
text | String | Nilai yang harus ada dalam input. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Text Does Not Contain(text)
Menetapkan aturan format bersyarat untuk dipicu saat input tidak berisi nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
text | String | Nilai yang tidak boleh ada dalam input. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Text Ends With(text)
Menetapkan aturan format bersyarat untuk dipicu saat input berakhir dengan nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
text | String | Teks yang akan dibandingkan dengan akhir string. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Text Equal To(text)
Menetapkan aturan format bersyarat untuk dipicu saat input sama dengan nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
text | String | Satu-satunya nilai yang dapat diterima. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
when Text Starts With(text)
Menetapkan aturan format bersyarat untuk dipicu saat input dimulai dengan nilai yang diberikan.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
text | String | Teks yang akan dibandingkan dengan awal string. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.
with Criteria(criteria, args)
Menetapkan aturan format bersyarat ke kriteria yang ditentukan oleh nilai Boolean
, biasanya diambil dari criteria
dan arguments
dari aturan yang ada.
// 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);
Parameter
Nama | Jenis | Deskripsi |
---|---|---|
criteria | Boolean | Jenis kriteria format bersyarat. |
args | Object[] | Array argumen yang sesuai dengan jenis kriteria; jumlah argumen dan jenisnya cocok dengan metode when...() yang sesuai di atas. |
Pulang pergi
Conditional
— Builder, untuk pengaitan.