Skip to main content
Glama
lubo3395
by lubo3395

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
xlsx_list_sheets

列出 xlsx 文件中所有 sheet 的名称、行数和列数。

参数:

  • file_path (string, 必填): xlsx 文件路径

返回:

  • file_path: 文件路径

  • sheets: Sheet 信息数组

    • name: Sheet 名称

    • rows: 行数

    • cols: 列数

示例:

  • "读取 test.xlsx 有哪些 sheet" -> { file_path: "test.xlsx" }

错误处理:

  • 文件不存在: "文件不存在: <路径>"

  • 不是 xlsx 文件: "不支持的文件格式: <路径>"

xlsx_read

读取 xlsx 文件中指定 sheet 的数据,支持 JSON 对象数组和二维数组两种格式。

参数:

  • file_path (string, 必填): xlsx 文件路径

  • sheet (string|number, 必填): sheet 名称或索引 (从 0 开始)

  • format (string, 默认 "json"): 输出格式

    • "json": 返回对象数组 (第一行为表头)

    • "array": 返回二维数组

  • range (string, 可选): 单元格范围,如 "A1:C10"

  • header_row (number, 默认 0): 表头行号,仅 json 格式有效

返回:

  • sheet: 读取的 sheet 名称

  • rows: 数据行数

  • cols: 数据列数

  • data: 表格数据

  • format: 数据格式

示例:

  • "读取 test.xlsx 的 Sheet1" -> { file_path: "test.xlsx", sheet: "Sheet1" }

  • "读取 test.xlsx 第一个 sheet 的 A1 到 C10 范围" -> { file_path: "test.xlsx", sheet: 0, range: "A1:C10" }

  • "以二维数组格式读取" -> { file_path: "test.xlsx", sheet: "Sheet1", format: "array" }

错误处理:

  • sheet 不存在: "Sheet "名称" 不存在。可用的 sheet: ..."

  • sheet 索引无效: "Sheet 索引无效: ..."

  • 文件不存在: "文件不存在: <路径>"

xlsx_create

从 JSON 数据创建新的 xlsx 文件。

参数:

  • file_path (string, 必填): 输出 xlsx 文件路径

  • data (string, 必填): JSON 数据字符串

    • 对象数组格式: [{"姓名": "张三", "年龄": 30}, {"姓名": "李四", "年龄": 25}]

    • 二维数组格式: [["姓名", "年龄"], ["张三", 30], ["李四", 25]]

  • sheet_name (string, 默认 "Sheet1"): sheet 名称

  • overwrite (boolean, 默认 false): 文件已存在时是否覆盖

返回:

  • file_path: 输出文件路径

  • sheet_name: sheet 名称

  • rows: 总行数

  • cols: 总列数

示例:

  • "创建 test.xlsx,包含 [{name:'张三',age:30},{name:'李四',age:25}]" -> { file_path: "test.xlsx", data: '[{"name":"张三","age":30},{"name":"李四","age":25}]' }

  • "覆盖已有文件" -> { file_path: "test.xlsx", data: "...", overwrite: true }

错误处理:

  • 文件已存在且未设置 overwrite: "文件已存在: ..."

  • 输出目录不存在: "输出目录不存在: ..."

  • 数据格式无效: "数据格式无效: ..."

xlsx_add_sheet

向已有的 xlsx 文件中添加新的 sheet。

参数:

  • file_path (string, 必填): 已存在的 xlsx 文件路径

  • data (string, 必填): JSON 数据字符串 (同 xlsx_create 的 data 参数)

  • sheet_name (string, 必填): 新 sheet 名称 (不能与已有 sheet 重名)

返回:

  • file_path: 文件路径

  • sheet_name: 新 sheet 名称

  • rows: 数据行数

  • cols: 数据列数

  • sheets: 更新后的所有 sheet 名称列表

示例:

  • "往 test.xlsx 添加一个名为 成绩表 的 sheet" -> { file_path: "test.xlsx", data: '[{"姓名":"张三","成绩":90}]', sheet_name: "成绩表" }

错误处理:

  • Sheet 名称已存在: "Sheet "名称" 已存在。可用 ..."

  • 文件不存在: "文件不存在: ..."

xlsx_update_cells

更新 xlsx 文件中指定 sheet 的单元格值。

参数:

  • file_path (string, 必填): xlsx 文件路径

  • sheet (string|number, 必填): sheet 名称或索引 (从 0 开始)

  • cells (string, 必填): 要更新的单元格,JSON 对象格式: {"A1": "值", "B2": 123, "C3": true}

返回:

  • file_path: 文件路径

  • sheet: 更新的 sheet

  • updated: 更新单元格数量

示例:

  • "把 test.xlsx 的 Sheet1 中 A1 改成 Hello" -> { file_path: "test.xlsx", sheet: "Sheet1", cells: '{"A1": "Hello"}' }

  • "批量修改多个单元格" -> { file_path: "test.xlsx", sheet: 0, cells: '{"A1": "标题", "B1": "值"}' }

错误处理:

  • cells 格式无效: "cells 格式无效: ..."

  • 单元格引用无效: "单元格引用无效: ..."

  • sheet 不存在: "Sheet ... 不存在"

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

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/lubo3395/mcp-xlsx-server'

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