Data Validation
Data validation constrains the input a user can enter in a cell. Through supported rule definitions, it can provide list and dropdown choices, numeric and date bounds and custom conditions. Apply rules to intentional worksheet ranges, and test both valid and invalid entries.
You inspect, add, update and remove validation rules with the validation command of the ribbon and its dialog, or in code with sheet.validation. The TypeScript reference entry ValidationRule lists the supported rule types, operators, messages and options.
Configure a Rule in the Dialog
Select the intended input cells and choose Data → Data Validation. This example allows a whole number of Units between 1 and 500:

- Open Settings and choose the allowed type and the operator.
- Fill in the bounds or the list source that the rule requires. A list rule shows choice and source settings instead of the numeric-bound fields.
- Open Input Message to configure the prompt shown on selection, or Error Alert to configure the error style, title and message.
- Select Apply to commit the rule, or Cancel to discard the draft.
Only one section opens at a time. The frame and bottom actions stay fixed while the settings scroll. Turning an input or error message off disables its fields in place, so their rows stay aligned and their draft text remains available when the message is enabled again.
Manage Rules in Code
sheet.validation is the Worksheet.validation property. It returns the SheetValidation of the worksheet, with these methods:
Design a Validation Workflow
- Store typed values and define the intended data type.
- Choose a rule and a target range.
- Supply a useful prompt and error message.
- Test typing, paste, fill and programmatic updates.
- Verify imported and exported validation in representative XLSX files.
Dropdown lists are useful for small, stable categories. Named ranges can make list sources more maintainable. Keep formula-based conditions within the supported calculation scope, and account for empty values deliberately.
Add Entry Controls With Cell Types
Supported cell-type configurations, described by CellTypeDefinition, provide additional entry controls such as button-style and choice-style cells. Custom cell renderers and editors belong to the application and must be registered with the control's cell-type registry, the CellTypeRegistry. Executable registration code is not serialized as workbook content.
Configure a Cell Type in the Editor
Select the cell and choose Insert → Cell Type. Choose Combo Box, Button, Radio List, Input Mask or Custom Renderer, then configure its Options section. Choice controls accept one item per line; a button accepts display text, an input mask accepts its pattern and a custom renderer refers to a renderer registered by the application.

With Allow Custom Combo Values enabled, the cell combines a text field with a dropdown arrow. The arrow opens every configured choice, including when the current value already matches an item. Select an item to store its configured value, or type a custom value and press Enter. Arrow keys navigate the open list, Escape closes it and Tab commits typed text. A locked cell on a protected sheet disables both entry and expansion.
The dialog keeps the same outer size when the selected type changes. Only applicable options can receive input or block validation. Choose Apply to save the draft, Cancel to discard it or Ordinary Cell to remove the cell type. Cell types are entry controls; configure validation separately when input also needs a rule.
Button cells show a hand pointer and pressed feedback. Clicking a button keeps the worksheet selection frame visible around the cell. A focused button also accepts Enter or Space; press F2 to edit its underlying cell value, or use the formula bar. Button activation raises the cellButtonClick event through editor.workbook.events, supplying the sheet ID, cell address and value. Changing a button's configured display text is done through Cell Type options.
What Validation Does Not Replace
Important
Not Authorization. Validation helps users enter data. It is not server authorization, and it is not a substitute for validating uploaded files and business rules in the host.
Protection and validation have separate purposes. A protected target may reject an otherwise valid change, while a validly entered value can still violate a higher-level business policy.
Next Steps
- Worksheet Protection: lock cells and restrict editing commands beside validation.
- Events and Cancellation: react to edits in your application.