Skip to main content
Glama

export_analysis

Export Excel analysis results like pivot tables and statistics to a new file for sharing or further processing.

Instructions

Export analysis results (pivot tables, statistics, etc.) to a new file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analysisTypeYesType of analysis to export
sourceFileYesPath to the source data file
outputFileYesPath for the output file
analysisParamsYesParameters for the analysis (depends on analysisType)

Implementation Reference

  • The exportAnalysis method implements the core logic of the 'export_analysis' tool. It processes different analysis types (pivot_table, statistical_analysis), prepares tabular data, writes it to an output file using the internal writeFile method, and returns a success response with export details.
    async exportAnalysis(args: ToolArgs): Promise<ToolResponse> { const { analysisType, sourceFile, outputFile, analysisParams } = args; let exportData: any[][] = []; switch (analysisType) { case 'pivot_table': { // This would need to call the analytics handler - simplified for now exportData = [ ['Group', 'Value', 'Count'], // Results would go here ]; break; } case 'statistical_analysis': { exportData = [ ['Metric', 'Value'], ['Column', 'Sample Column'], // Statistical results would go here ]; break; } // Add other analysis types as needed default: throw new Error(`Unsupported analysis type: ${analysisType}`); } // Write the analysis results to file await this.writeFile({ filePath: outputFile, data: exportData.slice(1), // Remove headers headers: exportData[0] // Use first row as headers }); return { content: [ { type: 'text', text: JSON.stringify({ success: true, analysisType, sourceFile, outputFile, rowsExported: exportData.length, }, null, 2), }, ], }; }
  • The tool schema definition for 'export_analysis' including name, description, and detailed inputSchema specifying parameters like analysisType, sourceFile, outputFile, and analysisParams.
    name: 'export_analysis', description: 'Export analysis results (pivot tables, statistics, etc.) to a new file', inputSchema: { type: 'object', properties: { analysisType: { type: 'string', description: 'Type of analysis to export', enum: ['pivot_table', 'statistical_analysis', 'correlation', 'data_profile'], }, sourceFile: { type: 'string', description: 'Path to the source data file', }, outputFile: { type: 'string', description: 'Path for the output file', }, analysisParams: { type: 'object', description: 'Parameters for the analysis (depends on analysisType)', }, }, required: ['analysisType', 'sourceFile', 'outputFile', 'analysisParams'], }, },
  • src/index.ts:1249-1251 (registration)
    Registration of the 'export_analysis' tool in the MCP server's CallToolRequestHandler switch statement, mapping the tool name to the FileOperationsHandler's exportAnalysis method.
    case 'export_analysis': return await this.fileOpsHandler.exportAnalysis(toolArgs); case 'format_cells':

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/ishayoyo/excel-mcp'

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