Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Excel.ConditionalColorScaleCriterion interface

Package:
excel

Represents a color scale criterion which contains a type, value, and a color.

Remarks

API set: ExcelApi 1.6

Used by

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/14-conditional-formatting/conditional-formatting-basic.yaml

await Excel.run(async (context) => {
 const sheet = context.workbook.worksheets.getItem("Sample");
 const range = sheet.getRange("B2:M5");
 const conditionalFormat = range.conditionalFormats
 .add(Excel.ConditionalFormatType.colorScale);
 const criteria = {
 minimum: { formula: null, type: Excel.ConditionalFormatColorCriterionType.lowestValue, color: "blue" },
 midpoint: { formula: "50", type: Excel.ConditionalFormatColorCriterionType.percent, color: "yellow" },
 maximum: { formula: null, type: Excel.ConditionalFormatColorCriterionType.highestValue, color: "red" }
 };
 conditionalFormat.colorScale.criteria = criteria;

 await context.sync();
});

Properties

color

HTML color code representation of the color scale color (e.g., #FF0000 represents Red).

formula

A number, a formula, or null (if type is lowestValue).

type

What the criterion conditional formula should be based on.

Property Details

color

HTML color code representation of the color scale color (e.g., #FF0000 represents Red).

color?: string;

Property Value

string

Remarks

API set: ExcelApi 1.6

formula

A number, a formula, or null (if type is lowestValue).

formula?: string;

Property Value

string

Remarks

API set: ExcelApi 1.6

type

What the criterion conditional formula should be based on.

type: Excel.ConditionalFormatColorCriterionType | "Invalid" | "LowestValue" | "HighestValue" | "Number" | "Percent" | "Formula" | "Percentile";

Property Value

Excel.ConditionalFormatColorCriterionType | "Invalid" | "LowestValue" | "HighestValue" | "Number" | "Percent" | "Formula" | "Percentile"

Remarks

API set: ExcelApi 1.6


Feedback

Was this page helpful?