// 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());}
// 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());}
// 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"]],["最后更新时间 (UTC):2025-08-05。"],[[["\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,["ConditionalFormatRule\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\nMethods\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`copy()` \nReturns a rule builder preset with this rule's settings.\n\nReturn\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()` \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\nReturn\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()` \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\nReturn\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()` \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\nReturn\n\n\n[Range[]](/apps-script/reference/spreadsheet/range) --- the ranges to which this conditional format rule is applied."]]