Skip to main content
Glama

excel_data_validation

Apply data validation rules to Excel ranges to restrict input types, ensure data integrity, and maintain spreadsheet accuracy for financial calculations.

Instructions

Add data validation to a range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rangeYes
validationYes
worksheetNameYes

Implementation Reference

  • Core handler implementation that applies data validation to the specified range in the worksheet using ExcelJS.
    async validateData( worksheetName: string, range: string, validation: ExcelJS.DataValidation ): Promise<void> { if (!this.workbook) { throw new Error('No workbook is currently open'); } const worksheet = this.workbook.getWorksheet(worksheetName); if (!worksheet) { throw new Error(`Worksheet "${worksheetName}" not found`); } const cells = worksheet.getCell(range); cells.dataValidation = validation; }
  • Tool registration object defining name, description, input schema, and handler stub that calls ExcelManager.validateData.
    { name: "excel_data_validation", description: "Add data validation to a range", inputSchema: { type: "object", properties: { worksheetName: { type: "string" }, range: { type: "string" }, validation: { type: "object", properties: { type: { type: "string" }, operator: { type: "string" }, formula1: { type: "string" }, formula2: { type: "string" }, allowBlank: { type: "boolean" }, showInputMessage: { type: "boolean" }, promptTitle: { type: "string" }, prompt: { type: "string" }, showErrorMessage: { type: "boolean" }, errorTitle: { type: "string" }, error: { type: "string" } } } }, required: ["worksheetName", "range", "validation"] }, handler: async (args: any): Promise<ToolResult> => { try { await excelManager.validateData(args.worksheetName, args.range, args.validation); return { success: true, message: `Added data validation to ${args.range}` }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
  • Input schema defining parameters for worksheetName, range, and detailed validation rules.
    inputSchema: { type: "object", properties: { worksheetName: { type: "string" }, range: { type: "string" }, validation: { type: "object", properties: { type: { type: "string" }, operator: { type: "string" }, formula1: { type: "string" }, formula2: { type: "string" }, allowBlank: { type: "boolean" }, showInputMessage: { type: "boolean" }, promptTitle: { type: "string" }, prompt: { type: "string" }, showErrorMessage: { type: "boolean" }, errorTitle: { type: "string" }, error: { type: "string" } } } }, required: ["worksheetName", "range", "validation"] },
  • src/index.ts:32-44 (registration)
    Main MCP server tool registration where excelTools (containing excel_data_validation) is included in the complete tools list.
    const allTools = [ ...excelTools, ...financialTools, ...rentalTools, ...expenseTools, ...reportingTools, ...cashFlowTools, ...taxTools, ...analyticsTools, ...chartTools, ...complianceTools, ...propertyTools, ];

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jeremycharlesgillespie/excel-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server