XLSX

Data Validation

List, number, date, and custom data validations

List Validation

Create dropdown lists for cells:

{
  "worksheets": [
    {
      "name": "Sheet1",
      "dataValidations": [
        {
          "sqref": "B2:B5",
          "type": "list",
          "formula1": "\"Yes,No,Maybe\""
        }
      ],
      "children": [
        { "cells": [{ "value": "Question" }, { "value": "Answer" }] },
        { "cells": [{ "value": "Do you agree?" }, { "value": null }] }
      ]
    }
  ]
}

Number Validation

{
  "worksheets": [
    {
      "name": "Sheet1",
      "dataValidations": [
        {
          "sqref": "A2:A100",
          "type": "whole",
          "operator": "between",
          "formula1": "0",
          "formula2": "100",
          "showErrorMessage": true,
          "errorTitle": "Invalid",
          "error": "Must be between 0 and 100"
        }
      ],
      "children": [{ "cells": [{ "value": "Score" }] }, { "cells": [{ "value": 85 }] }]
    }
  ]
}

Validation Types

Typetype valueDescription
List"list"Dropdown from values
Whole Number"whole"Integer validation
Decimal"decimal"Decimal number validation
Date"date"Date validation
Time"time"Time validation
Text Length"textLength"Text length validation
Custom"custom"Custom formula validation

Operators: between, notBetween, equal, notEqual, greaterThan, lessThan, greaterThanOrEqual, lessThanOrEqual.

Conditional Formatting

Apply formatting rules based on cell values:

{
  "worksheets": [
    {
      "name": "Sheet1",
      "conditionalFormats": [
        {
          "sqref": "B2:B5",
          "rules": [{ "type": "cellIs", "operator": "greaterThan", "formulas": ["100"] }]
        }
      ],
      "children": [
        { "cells": [{ "value": "Name" }, { "value": "Score" }] },
        { "cells": [{ "value": "Alice" }, { "value": 150 }] },
        { "cells": [{ "value": "Bob" }, { "value": 42 }] }
      ]
    }
  ]
}

DataValidation Options Reference

OptionTypeDescription
sqrefstringCell range, e.g. "A1:A10"
typestringValidation type (see table above)
operatorstringComparison operator
formula1stringFirst formula or value
formula2stringSecond formula (for between)
allowBlankbooleanAllow blank cells
showErrorMessagebooleanShow error alert
errorTitlestringError dialog title
errorstringError message
showInputMessagebooleanShow input message
promptTitlestringInput message title
promptstringInput message text
Copyright © 2026