ExcelDataValidationAgentTools Class
Provides AI agent tools for Excel data validation operations. Handles creating and managing data validation rules for cells and ranges.
Inherited Members
Namespace: Syncfusion.AI.AgentTools.Excel
Assembly: Syncfusion.DocumentSDK.AI.AgentTools.dll
Syntax
public class ExcelDataValidationAgentTools : AgentToolBase<IWorkbook>
Constructors
ExcelDataValidationAgentTools(DocumentStorageManager)
Initializes a new instance of the ExcelDataValidationAgentTools class (Mode 2 — DocumentStorage).
Declaration
public ExcelDataValidationAgentTools(DocumentStorageManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| DocumentStorageManager | manager | The document storage manager. |
ExcelDataValidationAgentTools(ExcelWorkbookManager)
Initializes a new instance of the ExcelDataValidationAgentTools class (Mode 1 — InMemory).
Declaration
public ExcelDataValidationAgentTools(ExcelWorkbookManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| ExcelWorkbookManager | manager | The Excel workbook manager. |
Methods
AddCustomValidation(String, String, String, String, Boolean, String, String, Boolean, String, String)
Adds custom formula validation to a cell or range.
Declaration
[Tool(Name = "AddCustomValidation", Description = "Adds custom formula-based validation to a cell or range. Supports both InMemory and DocumentStorage modes.")]
public AgentToolResult AddCustomValidation([ToolParameter(Description = "The workbook ID (InMemory mode) or input file path (DocumentStorage mode)")] string workbookIdOrFilePath, [ToolParameter(Description = "The name of the worksheet")] string worksheetName, [ToolParameter(Description = "The cell or range address")] string rangeAddress, [ToolParameter(Description = "The validation formula (e.g., =A1>10)")] string formula, [ToolParameter(Description = "Whether to show error message box")] bool showErrorBox = true, [ToolParameter(Description = "Optional title for error message box")] string errorTitle = null, [ToolParameter(Description = "Optional error message to display")] string errorMessage = null, [ToolParameter(Description = "Whether to show input prompt box")] bool showPromptBox = false, [ToolParameter(Description = "Optional prompt message to display")] string promptMessage = null, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only)")] string outputFilePath = "output_AddCustomValidation.xlsx")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | workbookIdOrFilePath | The workbook ID (InMemory mode) or input file path (DocumentStorage mode). |
| System.String | worksheetName | The name of the worksheet. |
| System.String | rangeAddress | The cell or range address. |
| System.String | formula | The validation formula (e.g., "=A1>10"). |
| System.Boolean | showErrorBox | Whether to show error message box. Default is true. |
| System.String | errorTitle | Optional title for the error message box. |
| System.String | errorMessage | Optional error message to display. |
| System.Boolean | showPromptBox | Whether to show input prompt box. Default is false. |
| System.String | promptMessage | Optional prompt message to display. |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result indicating success or failure. |
AddDateValidation(String, String, String, String, String, String, Boolean, String, String, Boolean, String, String)
Declaration
[Tool(Name = "AddDateValidation", Description = "Adds date validation to a cell or range with specified comparison operator and dates. Supports both InMemory and DocumentStorage modes.")]
public AgentToolResult AddDateValidation([ToolParameter(Description = "The workbook ID (InMemory mode) or input file path (DocumentStorage mode)")] string workbookIdOrFilePath, [ToolParameter(Description = "The name of the worksheet")] string worksheetName, [ToolParameter(Description = "The cell or range address")] string rangeAddress, [ToolParameter(Description = "Comparison operator must ONLY be these exact values: Between, NotBetween, Equal, NotEqual, Greater, GreaterOrEqual, Less, LessOrEqual. Do NOT use LessThan, GreaterThan, <, >, <=, >=, or other variants.")] string comparisonOperator, [ToolParameter(Description = "First date in yyyy-MM-dd format")] string firstDate, [ToolParameter(Description = "Optional second date in yyyy-MM-dd format (required for Between/NotBetween)")] string secondDate = null, [ToolParameter(Description = "Whether to show error message box")] bool showErrorBox = true, [ToolParameter(Description = "Optional title for error message box")] string errorTitle = null, [ToolParameter(Description = "Optional error message to display")] string errorMessage = null, [ToolParameter(Description = "Whether to show input prompt box")] bool showPromptBox = false, [ToolParameter(Description = "Optional prompt message to display")] string promptMessage = null, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only)")] string outputFilePath = "output_AddDateValidation.xlsx")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | workbookIdOrFilePath | |
| System.String | worksheetName | |
| System.String | rangeAddress | |
| System.String | comparisonOperator | |
| System.String | firstDate | |
| System.String | secondDate | |
| System.Boolean | showErrorBox | |
| System.String | errorTitle | |
| System.String | errorMessage | |
| System.Boolean | showPromptBox | |
| System.String | promptMessage | |
| System.String | outputFilePath |
Returns
| Type |
|---|
| AgentToolResult |
AddDropdownValidation(String, String, String, String, String, Boolean, String, String, Boolean, String, String)
Adds a dropdown list validation to a cell or range.
Declaration
[Tool(Name = "AddDropdownValidation", Description = "Adds a dropdown list data validation to a cell or range. List values are limited to 255 characters including separators. Supports both InMemory and DocumentStorage modes.")]
public AgentToolResult AddDropdownValidation([ToolParameter(Description = "The workbook ID (InMemory mode) or input file path (DocumentStorage mode)")] string workbookIdOrFilePath, [ToolParameter(Description = "The name of the worksheet")] string worksheetName, [ToolParameter(Description = "The cell or range address (e.g., A1 or A1:A10)")] string rangeAddress, [ToolParameter(Description = "The source range formula for range Validation(e.g., =Sheet1!$A$1:$A$10). Use this ONLY when the dropdown values come from a cell range. Leave null if using a custom list.")] string sourceRange = null, [ToolParameter(Description = "Comma-separated list of values (e.g., Option1,Option2,Option3). Use this ONLY when providing a custom list. Leave null if using a source range.")] string listValues = "", [ToolParameter(Description = "Whether to show error message box")] bool showErrorBox = true, [ToolParameter(Description = "Optional title for error message box")] string errorTitle = null, [ToolParameter(Description = "Optional error message to display")] string errorMessage = null, [ToolParameter(Description = "Whether to show input prompt box")] bool showPromptBox = false, [ToolParameter(Description = "Optional prompt message to display")] string promptMessage = null, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only)")] string outputFilePath = "output_AddDropdownValidation.xlsx")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | workbookIdOrFilePath | The workbook ID (InMemory mode) or input file path (DocumentStorage mode). |
| System.String | worksheetName | The name of the worksheet. |
| System.String | rangeAddress | The cell or range address (e.g., "A1" or "A1:A10"). |
| System.String | sourceRange | |
| System.String | listValues | Comma-separated list of values (e.g., "Option1,Option2,Option3"). Limited to 255 characters. |
| System.Boolean | showErrorBox | Whether to show error message box. Default is true. |
| System.String | errorTitle | Optional title for the error message box. |
| System.String | errorMessage | Optional error message to display. |
| System.Boolean | showPromptBox | Whether to show input prompt box. Default is false. |
| System.String | promptMessage | Optional prompt message to display. |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result indicating success or failure. |
AddNumberValidation(String, String, String, String, String, String, String, Boolean, String, String, Boolean, String, String)
Adds number validation to a cell or range.
Declaration
[Tool(Name = "AddNumberValidation", Description = "Adds number validation to a cell or range with specified comparison operator and values. Supports both InMemory and DocumentStorage modes.")]
public AgentToolResult AddNumberValidation([ToolParameter(Description = "The workbook ID (InMemory mode) or input file path (DocumentStorage mode)")] string workbookIdOrFilePath, [ToolParameter(Description = "The name of the worksheet")] string worksheetName, [ToolParameter(Description = "The cell or range address")] string rangeAddress, [ToolParameter(Description = "Number type ONLY these exact values: Integer or Decimal")] string numberType = "decimal", [ToolParameter(Description = "Comparison operator must ONLY be these exact values: Between, NotBetween, Equal, NotEqual, Greater, GreaterOrEqual, Less, LessOrEqual. Do NOT use LessThan, GreaterThan, <, >, <=, >=, or other variants.")] string comparisonOperator = "", [ToolParameter(Description = "The first value or minimum value")] string firstValue = "", [ToolParameter(Description = "Optional second value or maximum value (required for Between/NotBetween)")] string secondValue = null, [ToolParameter(Description = "Whether to show error message box")] bool showErrorBox = true, [ToolParameter(Description = "Optional title for error message box")] string errorTitle = null, [ToolParameter(Description = "Optional error message to display")] string errorMessage = null, [ToolParameter(Description = "Whether to show input prompt box")] bool showPromptBox = false, [ToolParameter(Description = "Optional prompt message to display")] string promptMessage = null, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only)")] string outputFilePath = "output_AddNumberValidation.xlsx")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | workbookIdOrFilePath | The workbook ID (InMemory mode) or input file path (DocumentStorage mode). |
| System.String | worksheetName | The name of the worksheet. |
| System.String | rangeAddress | The cell or range address. |
| System.String | numberType | The number type: Integer, Decimal. |
| System.String | comparisonOperator | The comparison operator: Between, NotBetween, Equal, NotEqual, Greater, GreaterOrEqual, Less, LessOrEqual. |
| System.String | firstValue | The first value or minimum value. |
| System.String | secondValue | Optional second value or maximum value (required for Between and NotBetween). |
| System.Boolean | showErrorBox | Whether to show error message box. Default is true. |
| System.String | errorTitle | Optional title for the error message box. |
| System.String | errorMessage | Optional error message to display. |
| System.Boolean | showPromptBox | Whether to show input prompt box. Default is false. |
| System.String | promptMessage | Optional prompt message to display. |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result indicating success or failure. |
AddTextLengthValidation(String, String, String, String, String, String, Boolean, String, String, Boolean, String, String)
Declaration
[Tool(Name = "AddTextLengthValidation", Description = "Adds text length validation to a cell or range with specified comparison operator and length values. Supports both InMemory and DocumentStorage modes.")]
public AgentToolResult AddTextLengthValidation([ToolParameter(Description = "The workbook ID (InMemory mode) or input file path (DocumentStorage mode)")] string workbookIdOrFilePath, [ToolParameter(Description = "The name of the worksheet")] string worksheetName, [ToolParameter(Description = "The cell or range address")] string rangeAddress, [ToolParameter(Description = "Comparison operator must ONLY be these exact values: Between, NotBetween, Equal, NotEqual, Greater, GreaterOrEqual, Less, LessOrEqual. Do NOT use LessThan, GreaterThan, <, >, <=, >=, or other variants.")] string comparisonOperator, [ToolParameter(Description = "First length value or minimum length")] string firstLength, [ToolParameter(Description = "Optional second length value or maximum length (required for Between/NotBetween)")] string secondLength = null, [ToolParameter(Description = "Whether to show error message box")] bool showErrorBox = true, [ToolParameter(Description = "Optional title for error message box")] string errorTitle = null, [ToolParameter(Description = "Optional error message to display")] string errorMessage = null, [ToolParameter(Description = "Whether to show input prompt box")] bool showPromptBox = false, [ToolParameter(Description = "Optional prompt message to display")] string promptMessage = null, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only)")] string outputFilePath = "output_AddTextLengthValidation.xlsx")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | workbookIdOrFilePath | |
| System.String | worksheetName | |
| System.String | rangeAddress | |
| System.String | comparisonOperator | |
| System.String | firstLength | |
| System.String | secondLength | |
| System.Boolean | showErrorBox | |
| System.String | errorTitle | |
| System.String | errorMessage | |
| System.Boolean | showPromptBox | |
| System.String | promptMessage | |
| System.String | outputFilePath |
Returns
| Type |
|---|
| AgentToolResult |
AddTimeValidation(String, String, String, String, String, String, Boolean, String, String, Boolean, String, String)
Declaration
[Tool(Name = "AddTimeValidation", Description = "Adds time validation to a cell or range with specified comparison operator and time values. Use 24-hour format like 10:00 or 18:30. Supports both InMemory and DocumentStorage modes.")]
public AgentToolResult AddTimeValidation([ToolParameter(Description = "The workbook ID (InMemory mode) or input file path (DocumentStorage mode)")] string workbookIdOrFilePath, [ToolParameter(Description = "The name of the worksheet")] string worksheetName, [ToolParameter(Description = "The cell or range address")] string rangeAddress, [ToolParameter(Description = "Comparison operator must ONLY be these exact values: Between, NotBetween, Equal, NotEqual, Greater, GreaterOrEqual, Less, LessOrEqual. Do NOT use LessThan, GreaterThan, <, >, <=, >=, or other variants.")] string comparisonOperator, [ToolParameter(Description = "First time value in HH:mm format (e.g., 10:00 or 18:30)")] string firstTime, [ToolParameter(Description = "Optional second time value in HH:mm format (required for Between/NotBetween)")] string secondTime = null, [ToolParameter(Description = "Whether to show error message box")] bool showErrorBox = true, [ToolParameter(Description = "Optional title for error message box")] string errorTitle = null, [ToolParameter(Description = "Optional error message to display")] string errorMessage = null, [ToolParameter(Description = "Whether to show input prompt box")] bool showPromptBox = false, [ToolParameter(Description = "Optional prompt message to display")] string promptMessage = null, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only)")] string outputFilePath = "output_AddTimeValidation.xlsx")
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | workbookIdOrFilePath | |
| System.String | worksheetName | |
| System.String | rangeAddress | |
| System.String | comparisonOperator | |
| System.String | firstTime | |
| System.String | secondTime | |
| System.Boolean | showErrorBox | |
| System.String | errorTitle | |
| System.String | errorMessage | |
| System.Boolean | showPromptBox | |
| System.String | promptMessage | |
| System.String | outputFilePath |
Returns
| Type |
|---|
| AgentToolResult |