Define a Conditional Formatter
Create a named formatter in theformatters section with one or more expression-style pairs. Each rule evaluates the expression and applies the referenced style when the condition is true:
expression evaluates to true determines the style applied to the cell.
Define the Styles
Each style referenced in a formatter must be defined in thestyles section or match one of the 20 predefined style names:
backgroundColor, color, fontWeight, and textDecoration.
Apply the Formatter to a Column
Reference the formatter by name in the column’sformatter property:
Conditional Formatting Evaluation Flow
Predefined Styles
Powersheet includes 20 built-in styles you can reference directly without defining them in thestyles section:
| Style Name | Description |
|---|---|
none | No styling |
boldTitle | Bold font weight |
readOnly | Read-only visual indicator |
unsupported | Strikethrough text |
grey / darkgrey | Grey background variants |
red / darkred | Red background variants |
orange / darkorange | Orange background variants |
green / darkgreen / lightgreen | Green background variants |
blue / darkblue / lightblue | Blue background variants |
teal / darkteal | Teal background variants |
purple / darkpurple / lightpurple | Purple background variants |
Use Expression Variables
Theexpression string is evaluated as JavaScript. The variable value represents the current cell value:
End your formatter rules with
expression: 'true' as a catch-all. Without a fallback, cells that match no rule receive no formatting.Complete Example
Verify
After saving the sheet configuration, reload the powersheet document. You should now see cells in the formatted columns displaying different background colors based on their values — critical items in red, major items in orange, and all other items in grey.See also
- Configure a Formatter
- Apply Column Styles
- Configure Read-Only Column
- Add a Column
- Sheet Configuration Guides
Sources
Sources
KB ArticlesSource Code
prod-powersheet-src/com.nextedy.powersheet.client/cypress/fixtures/configurations/whole_rtm.template.yamlpowersheet.yamlprod-powersheet-src/com.nextedy.powersheet.client/ltc-repo/packages/common/types/api/document.tsprod-powersheet-src/com.nextedy.powersheet.client/ltc-repo/packages/sheet/SheetComponent.tsxprod-powersheet-src/com.nextedy.powersheet.client/src/modules/ConfigProvider/ConfigProvider.tsx