Skip to main content
Glama

excel_protect_worksheet

Secure Excel worksheets with password protection to control user permissions for editing, formatting, and cell selection in financial spreadsheets.

Instructions

Protect a worksheet with a password

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
allowFormatCellsNo
allowFormatColumnsNo
allowFormatRowsNo
allowSelectLockedCellsNo
allowSelectUnlockedCellsNo
passwordYes
worksheetNameYes

Implementation Reference

  • Main tool handler that constructs protection options and calls ExcelManager.protectWorksheet
    handler: async (args: any): Promise<ToolResult> => { try { const protection = { selectLockedCells: args.allowSelectLockedCells, selectUnlockedCells: args.allowSelectUnlockedCells, formatCells: args.allowFormatCells, formatColumns: args.allowFormatColumns, formatRows: args.allowFormatRows }; await excelManager.protectWorksheet(args.worksheetName, args.password, protection); return { success: true, message: `Protected worksheet: ${args.worksheetName}` }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } }
  • Input schema defining parameters for protecting a worksheet including permissions
    inputSchema: { type: "object", properties: { worksheetName: { type: "string" }, password: { type: "string" }, allowSelectLockedCells: { type: "boolean", default: true }, allowSelectUnlockedCells: { type: "boolean", default: true }, allowFormatCells: { type: "boolean", default: false }, allowFormatColumns: { type: "boolean", default: false }, allowFormatRows: { type: "boolean", default: false } }, required: ["worksheetName", "password"] },
  • Core helper method that applies protection to the worksheet using ExcelJS
    async protectWorksheet( worksheetName: string, password: string, options?: Partial<ExcelJS.WorksheetProtection> ): 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`); } await worksheet.protect(password, options || {}); }
  • src/index.ts:32-44 (registration)
    Registration of all tools including excelTools which contains excel_protect_worksheet
    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