Skip to main content
Glama

excel_create_workbook

Create Excel workbooks with structured worksheets and financial data for analysis, reporting, and accounting workflows.

Instructions

Create a new Excel workbook with specified worksheets and data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
worksheetsYes

Implementation Reference

  • Core handler implementation in ExcelManager class that creates a new Excel workbook using ExcelJS, adds worksheets from input data, sets columns, and populates cells supporting formulas and styles.
    async createWorkbook(worksheets: WorksheetData[]): Promise<void> { this.workbook = new ExcelJS.Workbook(); for (const wsData of worksheets) { const worksheet = this.workbook.addWorksheet(wsData.name); if (wsData.columns) { worksheet.columns = wsData.columns; } wsData.data.forEach((row, rowIndex) => { row.forEach((cell, colIndex) => { const cellRef = worksheet.getCell(rowIndex + 1, colIndex + 1); if (typeof cell === 'object' && cell !== null && !(cell instanceof Date)) { const cellData = cell as CellValue; if (cellData.formula) { cellRef.value = { formula: cellData.formula }; } else { cellRef.value = cellData.value; } if (cellData.style) { Object.assign(cellRef, { style: cellData.style }); } } else { cellRef.value = cell; } }); }); } }
  • Input schema defining the structure for worksheets array, each with name, data (2D array), and optional columns.
    inputSchema: { type: "object", properties: { worksheets: { type: "array", items: { type: "object", properties: { name: { type: "string" }, data: { type: "array", items: { type: "array" } }, columns: { type: "array", items: { type: "object", properties: { header: { type: "string" }, key: { type: "string" }, width: { type: "number" } } } } }, required: ["name", "data"] } } }, required: ["worksheets"] },
  • Tool registration object defining name, description, inputSchema, and handler that delegates to ExcelManager.createWorkbook.
    { name: "excel_create_workbook", description: "Create a new Excel workbook with specified worksheets and data", inputSchema: { type: "object", properties: { worksheets: { type: "array", items: { type: "object", properties: { name: { type: "string" }, data: { type: "array", items: { type: "array" } }, columns: { type: "array", items: { type: "object", properties: { header: { type: "string" }, key: { type: "string" }, width: { type: "number" } } } } }, required: ["name", "data"] } } }, required: ["worksheets"] }, handler: async (args: any): Promise<ToolResult> => { try { await excelManager.createWorkbook(args.worksheets); return { success: true, message: `Created workbook with ${args.worksheets.length} worksheets` }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } },
  • src/index.ts:32-44 (registration)
    Main MCP server tool registration where excelTools (containing excel_create_workbook) is spread into the complete allTools array used for tool listing and execution.
    const allTools = [ ...excelTools, ...financialTools, ...rentalTools, ...expenseTools, ...reportingTools, ...cashFlowTools, ...taxTools, ...analyticsTools, ...chartTools, ...complianceTools, ...propertyTools, ];
  • Instantiation of the shared ExcelManager instance used by all Excel tools, including createWorkbook.
    const excelManager = new ExcelManager();

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