Stay organized with collections Save and categorize content based on your preferences.
GradientConditionAccess gradient (color) conditions in ConditionalFormatRuleApis
. Each conditional format rule may contain a single gradient condition. A gradient condition is defined by three points along a number scale (min, mid, and max), each of which has a color, a value, and a InterpolationType
. The content of a cell is compared to the values in the number scale and the color applied to the cell is interpolated based on the cell content's proximity to the gradient condition min, mid, and max points.
// Logs all the information inside gradient conditional format rules on a sheet. // The below snippet assumes all colors have ColorType.RGB. const sheet = SpreadsheetApp.getActiveSheet(); const rules = sheet.getConditionalFormatRules(); for (let i = 0; i < rules.length; i++) { const gradient = rules[i].getGradientCondition(); const minColor = gradient.getMinColorObject().asRgbColor().asHexString(); const minType = gradient.getMinType(); const minValue = gradient.getMinValue(); const midColor = gradient.getMidColorObject().asRgbColor().asHexString(); const midType = gradient.getMidType(); const midValue = gradient.getMidValue(); const maxColor = gradient.getMaxColorObject().asRgbColor().asHexString(); const maxType = gradient.getMaxType(); const maxValue = gradient.getMaxValue(); Logger.log(`The conditional format gradient information for rule ${i}: MinColor ${minColor}, MinType ${minType}, MinValue ${minValue}, MidColor ${midColor}, MidType ${midType}, MidValue ${midValue}, MaxColor ${maxColor}, MaxType ${maxType}, MaxValue ${maxValue}`); }Methods Deprecated methods Method Return type Brief description
getMaxColor()
String
Gets the color set for the maximum value of this gradient condition. getMidColor()
String
Gets the color set for the midpoint value of this gradient condition. getMinColor()
String
Gets the color set for the minimum value of this gradient condition. Detailed documentation getMaxColorObject()
Gets the color set for the maximum value of this gradient condition. Returns null
if the color hasn't been set.
Color
— The color set for the maximum value of this gradient condition or null
.
getMaxType()
Gets the interpolation type for the maximum value of this gradient condition. Returns null
if the gradient max type hasn't been set.
InterpolationType
— The interpolation type for the maximum value of this gradient condition or null
.
getMaxValue()
Gets the max value of this gradient condition. Returns an empty string if the InterpolationType
is MAX
or if the max value hasn't been set.
String
— The maximum value if specified or an empty string.
getMidColorObject()
Gets the color set for the midpoint value of this gradient condition. Returns null
if the color hasn't been set.
Color
— The color set for the midpoint value of this gradient condition or null
.
getMidType()
Gets the interpolation type for the midpoint value of this gradient condition. Returns null
if the gradient mid type hasn't been set.
InterpolationType
— The interpolation type for the midpoint value of this gradient condition or null
.
getMidValue()
Gets the midpoint value of this gradient condition. Returns an empty string if the gradient mid value hasn't been set.
ReturnString
— The midpoint value or an empty string.
getMinColorObject()
Gets the color set for the minimum value of this gradient condition. Returns null
if the color hasn't been set.
Color
— The color set for the minimum value of this gradient condition or null
.
getMinType()
Gets the interpolation type for the minimum value of this gradient condition. Returns null
if the gradient min type hasn't been set.
InterpolationType
— The interpolation type for the minimum value of this gradient condition or null
.
getMinValue()
Gets the minimum value of this gradient condition. Returns an empty string if the InterpolationType
is MIN
or if the min value hasn't been set.
String
— The minimum value if specified or an empty string.
getMaxColor()
Deprecated. Replaced by getMaxColorObject()
Gets the color set for the maximum value of this gradient condition. Returns an empty string if the color hasn't been set.
ReturnString
— The color set for the maximum value of this gradient condition or an empty string.
getMidColor()
Deprecated. Replaced by getMidColorObject()
Gets the color set for the midpoint value of this gradient condition. Returns an empty string if the color hasn't been set.
ReturnString
— The color set for the midpoint value of this gradient condition or an empty string.
getMinColor()
Deprecated. Replaced by getMinColorObject()
Gets the color set for the minimum value of this gradient condition. Returns an empty string if the color hasn't been set.
ReturnString
— The color set for the minimum value of this gradient condition or an empty string.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-04 UTC."],[[["Gradient conditions in Google Sheets allow you to apply color scales to cells based on their values, interpolating colors between minimum, midpoint, and maximum points."],["Each gradient condition is defined by three points (min, mid, max), each having a color, value, and interpolation type."],["You can access and manipulate gradient conditions programmatically using Apps Script methods like `getMinColorObject()`, `getMidValue()`, and `getMaxType()`."],["Deprecated methods like `getMinColor()`, `getMidColor()`, and `getMaxColor()` have been replaced by object-based alternatives for color retrieval."]]],["Gradient conditions, within conditional format rules, define cell colors based on a number scale with minimum, midpoint, and maximum values. Each point has a color, value, and interpolation type. Methods like `getMinColorObject()`, `getMidType()`, and `getMaxValue()` retrieve these attributes. Cell content is compared to these values to interpolate and apply a corresponding color. Deprecated methods (`getMinColor()`, `getMidColor()`, `getMaxColor()`) are replaced with `get[Point]ColorObject()`.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4