이 규칙이 불리언 조건 기준을 사용하는 경우 규칙의 BooleanCondition 정보를 가져옵니다. 그 외에는 null을 반환합니다.
// Log the boolean criteria type of the first conditional format rules of a// sheet.construle=SpreadsheetApp.getActiveSheet().getConditionalFormatRules()[0];constbooleanCondition=rule.getBooleanCondition();if(booleanCondition!=null){Logger.log(booleanCondition.getCriteriaType());}
리턴
BooleanCondition - 불리언 조건 객체입니다. 규칙에서 불리언 조건을 사용하지 않는 경우 null입니다.
getGradientCondition()
이 규칙이 그라데이션 조건 기준을 사용하는 경우 규칙의 GradientCondition 정보를 가져옵니다. 그 외에는 null을 반환합니다.
// Log the gradient minimum color of the first conditional format rule of a// sheet.construle=SpreadsheetApp.getActiveSheet().getConditionalFormatRules()[0];constgradientCondition=rule.getGradientCondition();if(gradientCondition!=null){// Assume the color has ColorType.RGB.Logger.log(gradientCondition.getMinColorObject().asRgbColor().asHexString());}
리턴
GradientCondition - 그라데이션 조건 객체입니다. 규칙에서 그라데이션 조건을 사용하지 않는 경우 null입니다.
getRanges()
이 조건부 서식 규칙이 적용되는 범위를 가져옵니다.
// Log each range of the first conditional format rule of a sheet.construle=SpreadsheetApp.getActiveSheet().getConditionalFormatRules()[0];constranges=rule.getRanges();for(leti=0;i < ranges.length;i++){Logger.log(ranges[i].getA1Notation());}
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-05(UTC)"],[[["\u003cp\u003e\u003ccode\u003eXFrameOptionsMode\u003c/code\u003e is used to control how a client-side Apps Script HTML Service output can be embedded in iframes on other websites.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eALLOWALL\u003c/code\u003e permits any site to embed the page, demanding developer-implemented clickjacking protection, while \u003ccode\u003eDEFAULT\u003c/code\u003e maintains standard security with no \u003ccode\u003eX-Frame-Options\u003c/code\u003e header.\u003c/p\u003e\n"],["\u003cp\u003eIf a script doesn't explicitly set a mode, Apps Script defaults to \u003ccode\u003eDEFAULT\u003c/code\u003e, ensuring standard security behaviors are in effect.\u003c/p\u003e\n"]]],["Conditional format rules can be accessed and managed using the provided methods. New rules are created via `SpreadsheetApp.newConditionalFormatRule()`. Existing rules can be copied with `copy()`, retrieving a builder with the same settings. The `getBooleanCondition()` and `getGradientCondition()` methods fetch information based on the rule's criteria, while `getRanges()` retrieves the ranges the rule applies to. `Sheet.setConditionalFormatRules(rules)` applies rule settings to a given sheet.\n"],null,["# Class ConditionalFormatRule\n\nConditionalFormatRule\n\nAccess conditional formatting rules. To create a new rule, use [SpreadsheetApp.newConditionalFormatRule()](/apps-script/reference/spreadsheet/spreadsheet-app#newConditionalFormatRule()) and [ConditionalFormatRuleBuilder](/apps-script/reference/spreadsheet/conditional-format-rule-builder).\nYou can use [Sheet.setConditionalFormatRules(rules)](/apps-script/reference/spreadsheet/sheet#setConditionalFormatRules(ConditionalFormatRule)) to set the\nrules for a given sheet. \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------|----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [copy()](#copy()) | [ConditionalFormatRuleBuilder](/apps-script/reference/spreadsheet/conditional-format-rule-builder) | Returns a rule builder preset with this rule's settings. |\n| [getBooleanCondition()](#getBooleanCondition()) | [BooleanCondition](/apps-script/reference/spreadsheet/boolean-condition) | Retrieves the rule's [BooleanCondition](/apps-script/reference/spreadsheet/boolean-condition) information if this rule uses boolean condition criteria. |\n| [getGradientCondition()](#getGradientCondition()) | [GradientCondition](/apps-script/reference/spreadsheet/gradient-condition) | Retrieves the rule's [GradientCondition](/apps-script/reference/spreadsheet/gradient-condition) information, if this rule uses gradient condition criteria. |\n| [getRanges()](#getRanges()) | [Range[]](/apps-script/reference/spreadsheet/range) | Retrieves the ranges to which this conditional format rule is applied. |\n\nDetailed documentation\n----------------------\n\n### `copy()`\n\nReturns a rule builder preset with this rule's settings.\n\n#### Return\n\n\n[ConditionalFormatRuleBuilder](/apps-script/reference/spreadsheet/conditional-format-rule-builder) --- A builder based on this rule's settings.\n\n*** ** * ** ***\n\n### `get``Boolean``Condition()`\n\nRetrieves the rule's [BooleanCondition](/apps-script/reference/spreadsheet/boolean-condition) information if this rule uses\nboolean condition criteria. Otherwise returns `null`.\n\n```javascript\n// Log the boolean criteria type of the first conditional format rules of a\n// sheet.\nconst rule = SpreadsheetApp.getActiveSheet().getConditionalFormatRules()[0];\nconst booleanCondition = rule.getBooleanCondition();\nif (booleanCondition != null) {\n Logger.log(booleanCondition.getCriteriaType());\n}\n```\n\n#### Return\n\n\n[BooleanCondition](/apps-script/reference/spreadsheet/boolean-condition) --- The boolean condition object, or `null` if the rule does not use a boolean\ncondition.\n\n*** ** * ** ***\n\n### `get``Gradient``Condition()`\n\nRetrieves the rule's [GradientCondition](/apps-script/reference/spreadsheet/gradient-condition) information, if this rule\nuses gradient condition criteria. Otherwise returns `null`.\n\n```javascript\n// Log the gradient minimum color of the first conditional format rule of a\n// sheet.\nconst rule = SpreadsheetApp.getActiveSheet().getConditionalFormatRules()[0];\nconst gradientCondition = rule.getGradientCondition();\nif (gradientCondition != null) {\n // Assume the color has ColorType.RGB.\n Logger.log(gradientCondition.getMinColorObject().asRgbColor().asHexString());\n}\n```\n\n#### Return\n\n\n[GradientCondition](/apps-script/reference/spreadsheet/gradient-condition) --- The gradient condition object, or `null` if the rule does not use a gradient\ncondition.\n\n*** ** * ** ***\n\n### `get``Ranges()`\n\nRetrieves the ranges to which this conditional format rule is applied.\n\n```javascript\n// Log each range of the first conditional format rule of a sheet.\nconst rule = SpreadsheetApp.getActiveSheet().getConditionalFormatRules()[0];\nconst ranges = rule.getRanges();\nfor (let i = 0; i \u003c ranges.length; i++) {\n Logger.log(ranges[i].getA1Notation());\n}\n```\n\n#### Return\n\n\n[Range[]](/apps-script/reference/spreadsheet/range) --- The ranges to which this conditional format rule is applied."]]