Skip to main content
Glama

export_to_csv

Convert Excel worksheet data to CSV format using file paths and sheet names for accurate and structured data export.

Instructions

ワークシートをCSVファイルにエクスポートします

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
csvPathYesCSVファイルの出力パス
filePathYesExcelファイルのパス(既存ファイル)
sheetNameYesワークシート名(既存シート)

Implementation Reference

  • The core handler function that loads the Excel workbook, retrieves the specified worksheet, and exports it to a CSV file using ExcelJS.
    async function exportToCSV(filePath: string, sheetName: string, csvPath: string): Promise<string> { try { const workbook = await loadWorkbook(filePath); const worksheet = workbook.getWorksheet(sheetName); if (!worksheet) { throw new Error(`ワークシート '${sheetName}' が見つかりません。`); } await workbook.csv.writeFile(csvPath, { sheetName }); return `ワークシート '${sheetName}' をCSVファイル '${csvPath}' にエクスポートしました。`; } catch (error) { throw new McpError(ErrorCode.InternalError, `CSV出力エラー: ${error}`); } }
  • Zod schema defining the input parameters for the export_to_csv tool: filePath, sheetName, and csvPath.
    const ExportToCSVSchema = z.object({ filePath: z.string().describe("Excelファイルのパス(既存ファイル)"), sheetName: z.string().describe("ワークシート名(既存シート)"), csvPath: z.string().describe("CSVファイルの出力パス"), });
  • src/index.ts:517-520 (registration)
    Registration of the export_to_csv tool in the ListTools response, including name, description, and input schema.
    name: "export_to_csv", description: "ワークシートをCSVファイルにエクスポートします", inputSchema: zodToJsonSchema(ExportToCSVSchema) }
  • src/index.ts:567-570 (registration)
    The tool handler registration in the toolImplementations map, which parses args with the schema and delegates to the exportToCSV function.
    export_to_csv: async (args: any) => { const { filePath, sheetName, csvPath } = ExportToCSVSchema.parse(args); return await exportToCSV(filePath, sheetName, csvPath); }

Other Tools

Related 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/SuperPyonchiX/excel_mcp_server'

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