XLSX Conditional Formatting Rule

Batch-apply conditional formatting rules such as threshold highlights, data bars, and color scales to Excel worksheets

Apply conditional formatting in batch.

  • Supports threshold rules like value > 100 in red
  • Supports data bars and 2/3-color scales
  • Supports text contains and formula expression rules
  • Uses ExcelJS native conditional formatting support

Example Results

1 examples

Apply highlights, data bars, and color scales

Batch-format worksheet ranges with threshold and gradient rules

xlsx-conditional-formatting-rule-example1.xlsx View File
View input parameters
{ "workbookFile": "/public/samples/xlsx/workbook-sales.xlsx", "rulesJson": "[\n {\n \"sheetName\": \"Tools API\",\n \"ref\": \"H2:H20\",\n \"type\": \"cellIs\",\n \"operator\": \"greaterThan\",\n \"formulae\": [\n 0\n ],\n \"fillColor\": \"#DCFCE7\",\n \"fontColor\": \"#166534\"\n }\n]" }

Click to upload file or drag and drop file here

Maximum file size: 20MB Supported formats: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel

Key Facts

Category
Conversion & Encoding
Input Types
file, textarea
Output Type
file
Sample Coverage
4
API Ready
Yes

Overview

The XLSX Conditional Formatting Rule tool allows you to programmatically apply complex formatting styles to your Excel workbooks in bulk. By defining rules in JSON, you can automatically highlight data thresholds, visualize trends with data bars, or apply color scales to large datasets without manual editing.

When to Use

  • When you need to apply consistent formatting rules across multiple sheets or large data ranges.
  • When you want to automate the visual identification of outliers, targets, or performance metrics.
  • When you need to standardize the appearance of reports by applying data bars or color scales based on specific cell values.

How It Works

  • Upload your Excel workbook file (.xlsx or .xls).
  • Define your formatting logic in the Rules JSON field, specifying the sheet name, cell range, and rule type.
  • Submit the configuration to process the file and generate a new version with the applied formatting.
  • Download the updated workbook containing your applied conditional styles.

Use Cases

Automating risk alerts by highlighting cells that fall below a specific safety or performance threshold.
Generating visual KPI dashboards that use data bars to represent progress toward goals.
Standardizing data quality reports by applying color scales to identify high and low values across large datasets.

Examples

1. Automated KPI Performance Dashboard

Sales Manager
Background
The manager needs to format a weekly sales report containing hundreds of entries to highlight performance.
Problem
Manually applying colors to cells based on sales targets is time-consuming and prone to human error.
How to Use
Upload the sales report and define threshold rules in the JSON input to color-code performance.
Example Config
[
  {
    "sheetName": "2026 Sales",
    "ref": "H2:H100",
    "type": "cellIs",
    "operator": "greaterThan",
    "formulae": [100000],
    "fillColor": "#DCFCE7",
    "fontColor": "#166534"
  },
  {
    "sheetName": "2026 Sales",
    "ref": "I2:I100",
    "type": "dataBar"
  }
]
Outcome
Cells exceeding 100,000 are automatically highlighted in green, and column I displays data bars for visual completion tracking.

2. Inventory Risk Assessment

Warehouse Coordinator
Background
The coordinator tracks stock levels across multiple warehouses and needs to identify low-stock items immediately.
Problem
Identifying items with stock levels below 10 units across thousands of rows is difficult to do manually.
How to Use
Apply a 'lessThan' rule to the stock quantity column to highlight critical items in red.
Example Config
[
  {
    "sheetName": "Inventory",
    "ref": "C2:C500",
    "type": "cellIs",
    "operator": "lessThan",
    "formulae": [10],
    "fillColor": "#FEE2E2",
    "fontColor": "#991B1B"
  }
]
Outcome
All items with stock levels below 10 are instantly highlighted in red, allowing for immediate restocking action.

Try with Samples

json, xml, xlsx

Related Hubs

FAQ

What types of formatting rules are supported?

The tool supports threshold-based cell highlighting, data bars, color scales, and text-contains rules.

Can I apply multiple rules to the same range?

Yes, you can define an array of rules in the JSON configuration to apply multiple formatting layers to the same or different ranges.

Is my original file modified?

No, the tool generates a new processed file, leaving your original source file unchanged.

What format should the Rules JSON follow?

The JSON should be an array of objects, each containing keys for sheetName, ref (range), type, and specific parameters like fillColor or operator.

Are there limits on the file size?

The tool supports files up to 20MB to ensure efficient processing.

API Documentation

Request Endpoint

POST /en/api/tools/xlsx-conditional-formatting-rule

Request Parameters

Parameter Name Type Required Description
workbookFile file (Upload required) Yes -
rulesJson textarea Yes -

File type parameters need to be uploaded first via POST /upload/xlsx-conditional-formatting-rule to get filePath, then pass filePath to the corresponding file field.

Response Format

{
  "filePath": "/public/processing/randomid.ext",
  "fileName": "output.ext",
  "contentType": "application/octet-stream",
  "size": 1024,
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
File: File

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-xlsx-conditional-formatting-rule": {
      "name": "xlsx-conditional-formatting-rule",
      "description": "Batch-apply conditional formatting rules such as threshold highlights, data bars, and color scales to Excel worksheets",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=xlsx-conditional-formatting-rule",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

Supports URL file links or Base64 encoding for file parameters.

If you encounter any issues, please contact us at [email protected]