excel_delete_worksheet
Remove unwanted worksheets from Excel workbooks to maintain organized financial data and streamline accounting workflows.
Instructions
Delete a worksheet from the current workbook
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/tools/excel-tools.ts:199-223 (handler)The tool handler: defines the tool, its input schema, and the execution logic that delegates to ExcelManager.deleteWorksheet{ name: "excel_delete_worksheet", description: "Delete a worksheet from the current workbook", inputSchema: { type: "object", properties: { name: { type: "string" } }, required: ["name"] }, handler: async (args: any): Promise<ToolResult> => { try { await excelManager.deleteWorksheet(args.name); return { success: true, message: `Deleted worksheet: ${args.name}` }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
- src/tools/excel-tools.ts:202-208 (schema)Input schema requiring the worksheet 'name' stringinputSchema: { type: "object", properties: { name: { type: "string" } }, required: ["name"] },
- src/excel/excel-manager.ts:174-185 (helper)Core implementation: retrieves worksheet by name and calls ExcelJS workbook.removeWorksheetasync deleteWorksheet(name: string): Promise<void> { if (!this.workbook) { throw new Error('No workbook is currently open'); } const worksheet = this.workbook.getWorksheet(name); if (!worksheet) { throw new Error(`Worksheet "${name}" not found`); } this.workbook.removeWorksheet(worksheet.id); }
- src/index.ts:32-44 (registration)Registration: excelTools (containing excel_delete_worksheet) spread into allTools array used by MCP server for tool listing and executionconst allTools = [ ...excelTools, ...financialTools, ...rentalTools, ...expenseTools, ...reportingTools, ...cashFlowTools, ...taxTools, ...analyticsTools, ...chartTools, ...complianceTools, ...propertyTools, ];