Excel AI代理工具

一个开源的Excel AI代理工具,提供Excel文件编辑和自动化处理功能。

  • by SylvianAI
  • Python
  • 本地部署
  • 304 星标
  • 更新于
在 GitHub 查看 SylvianAI/sv-excel-agent

使用说明

开源Excel AI代理

此存储库由两个主要部分组成:Excel MCP服务器(excel_mcp)以及Excel AI代理运行程序(excel_agent).

演示

Excel助手

看 demo/ExcelAssistant 用于web应用程序表单中的AI Excel助手。

https://github.com/user-attachments/assets/18b6b8b5-0943-4c5b-816b-587f1083311d

Slack工作流

看 demo/SlackExcelWorkflow 制作一个Slack机器人来协助你的Excel工作。

https://github.com/user-attachments/assets/40611a73-3d4b-4fd2-8626-eb0c6ee8d3c5

模型性能

使用我们的代理,我们在SpreadsheetBench的50个经过验证的示例子集上对几个领先的模型进行了基准测试。以下是以下结果Pass@1:

您可以在 evals 文件夹。

环境设置

conda create -n excel
conda activate excel
conda install python=3.11
pip install -r requirements.txt
pip install -e .

一般使用

设置AI Agent包括两部分。Excel MCP服务器允许所有代理访问一组约30个工具,这些工具允许直接编辑Excel文件。

设置Excel MCP服务器

import asyncio
from excel_mcp.excel_server import mcp

async def run_mcp_server():
    await mcp.run_sse_async(host="127.0.0.1", port=8765)

asyncio.run(run_mcp_server())

设置Excel代理运行程序

from excel_agent.agent_runner import ExcelAgentRunner, TaskInput
from excel_agent.config import ExperimentConfig

message = #some prompt to edit the Excel file
input_file = #path to input Excel file
output_file = #path to output Excel file. typically a copy of the input file is created to edit.

runner = ExcelAgentRunner(
    config=ExperimentConfig(model='openrouter:openai/gpt-5.1'),
    mcp_server_url="http://127.0.0.1:8765/sse",
)

task_input = TaskInput(
    instruction=message,
    input_file=str(input_path),
    output_file=str(output_path),
)

agent_response = await runner.run_excel_agent(task_input)

环境

评估工具启动 微软Excel 在比较过程中计算公式并应用格式。这确保了对公式输出和条件格式的准确评估。

对于无头环境, 办公套件 可以用作电子表格转换的替代方案。然而,LibreOffice的转换不太准确,特别是对于复杂的公式和条件格式,可能会导致评估差异。