Skip to content
Productivity
Skill

/wecomcli-smartsheet

企业微信智能表格(smartsheet)管理技能。提供智能表格的新建(doc_type=10)、结构管理(子表、字段/列)和数据管理(记录增删改查)。适用场景:(1) 从零新建智能表格 (2) 管理智能表格子表和字段/列 (3) 查询、添加、更新、删除智能表格记录。支持通过 docid 或文档 URL 定位文档。当用户提到「企业微信智能表格」「智能表格」,或链接形如 `https://doc.weixin.qq.com/smartsheet/xxx` 时触发该技能。注意:普通文档(`/doc/*`)请用

From plugin
wecom-cli
2.6k9 skills
Install
$ npx -y skills add wecomteam/wecom-cli --skill wecomcli-smartsheet --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/wecomcli-smartsheet

Context preview

The summary Claude sees to decide when to auto-load this skill.

企业微信智能表格(smartsheet)管理技能。提供智能表格的新建(doc_type=10)、结构管理(子表、字段/列)和数据管理(记录增删改查)。适用场景:(1) 从零新建智能表格 (2) 管理智能表格子表和字段/列 (3) 查询、添加、更新、删除智能表格记录。支持通过 docid 或文档 URL 定位文档。当用户提到「企业微信智能表格」「智能表格」,或链接形如 `https://doc.weixin.qq.com/smartsheet/xxx` 时触发该技能。注意:普通文档(`/doc/*`)请用

SKILL.md

wecomcli-smartsheet.SKILL.md
name: wecomcli-smartsheet
description: 企业微信智能表格(smartsheet)管理技能。提供智能表格的新建(doc_type=10)、结构管理(子表、字段/列)和数据管理(记录增删改查)。适用场景:(1) 从零新建智能表格 (2) 管理智能表格子表和字段/列 (3) 查询、添加、更新、删除智能表格记录。支持通过 docid 或文档 URL 定位文档。当用户提到「企业微信智能表格」「智能表格」,或链接形如 `https://doc.weixin.qq.com/smartsheet/xxx` 时触发该技能。注意:普通文档(`/doc/*`)请用 `wecomcli-doc`;在线表格(`/sheet/*`)请用 `wecomcli-sheet`;智能文档/智能主页(`/smartpage/*`)请用 `wecomcli-smartpage`。
metadata:
  requires:
    bins: ["wecom-cli"]
  cliHelp: "wecom-cli doc --help"

企业微信智能表格管理

> `wecom-cli` 是企业微信提供的命令行程序,所有操作通过执行 `wecom-cli` 命令完成。

资源型技能,负责**智能表格**(`/smartsheet/*`,doc_type=10)的新建、结构(子表、字段/列)与数据(记录)管理。所有接口支持通过 `docid` 或 `url` 二选一定位文档。

调用方式

通过 `wecom-cli` 调用,品类为 `doc`:

wecom-cli doc <tool_name> '<json_params>'

> 智能表格各接口的 `docid`/`url` 二选一传入即可,以下示例以 `docid` 为主,URL 传入方式以此类推。

返回格式说明

所有接口返回 JSON 对象,包含以下公共字段:

| 字段 | 类型 | 说明 | |------|------|------| | `errcode` | integer | 返回码,`0` 表示成功,非 `0` 表示失败 | | `errmsg` | string | 错误信息,成功时为 `"ok"` |

当 `errcode` 不为 `0` 时,说明接口调用失败,可重试 1 次;若仍失败,将 `errcode` 和 `errmsg` 展示给用户。

特殊错误码

| errcode | errmsg | 含义 | 处理方式 | |---------|--------|------|----------| | `851002` | `incompatible doc type` | 文档品类与所调用的接口不匹配 | 确认目标 URL 为 `/smartsheet/*`;若不是,请跳转到对应品类的 skill |

接口路由表

> **硬规则**:第二列是 `references/xxx.md` 链接的,命中这一行后**先 `read` 对应 references 文件,再构造命令**。写入/读取记录前,先用 `smartsheet_get_sheet` 拿到目标子表的 `sheet_id`,并用 `smartsheet_get_fields` 了解字段类型。

| 用户意图 | 参考位置 | |---|---| | 从零新建智能表格(空白) | 见下方「新建智能表格」 | | 查询文档中所有子表 | 见下方「查询子表」 | | 添加 / 改名 / 删除子表 | 见下方「子表管理」 | | 查询子表字段/列 | 见下方「查询字段」 | | 添加字段/列 | [references/smartsheet-field-types.md](references/smartsheet-field-types.md) | | 改名 / 删除字段 | 见下方「字段管理」 | | 查询子表记录 | [references/smartsheet-get-records.md](references/smartsheet-get-records.md) | | 添加记录 / 更新记录 | [references/smartsheet-cell-value-formats.md](references/smartsheet-cell-value-formats.md) | | 删除记录 | 见下方「删除记录」 |

---

一、新建智能表格

新建智能表格

从零新建一篇企微**智能表格**(doc_type=10):空白。创建成功后返回 `docid` 和 `url`。

**命令**

wecom-cli doc create_doc '<JSON 参数>'

**参数**

| 参数 | 类型 | 必填 | 默认值 | 说明 | |---|---|---|---|---| | `doc_type` | int | 是 | — | 固定传 `10`(智能表格) | | `doc_name` | string | 是 | — | 表格标题,最多 255 个字符,超过会被截断 |

**注意事项**

  • 新建智能表格文档**默认已含一个子表**,可通过 `smartsheet_get_sheet` 查询其 `sheet_id`,仅需多个子表时才调用 `smartsheet_add_sheet`。
  • `docid` 仅在创建时返回,后续无法再获取,务必保存。

---

二、智能表格结构管理

查询子表

查询文档中所有子表信息,返回 `sheet_id`、`title`、类型等。

# 通过 docid 查询
wecom-cli doc smartsheet_get_sheet '{"docid": "DOCID"}'
# 通过 url 查询
wecom-cli doc smartsheet_get_sheet '{"url": "https://doc.weixin.qq.com/smartsheet/xxx"}'

子表管理

**添加子表** —— 添加空子表。新子表不含视图、记录和字段,需通过其他接口补充。

wecom-cli doc smartsheet_add_sheet '{"docid": "DOCID", "properties": {"title": "新子表"}}'

> 注意:新建智能表格文档默认已含一个子表,仅需多个子表时调用。

**修改子表标题** —— 需提供 `sheet_id` 和新 `title`。

wecom-cli doc smartsheet_update_sheet '{"docid": "DOCID", "properties":{"sheet_id":"SHEET_ID", "title":"新子表"}}'

**删除子表** —— 永久删除子表,**操作不可逆**。

wecom-cli doc smartsheet_delete_sheet '{"docid": "DOCID", "sheet_id": "SHEETID"}'

查询字段

查询子表的所有字段信息,返回 `field_id`、`field_title`、`field_type`。

wecom-cli doc smartsheet_get_fields '{"docid": "DOCID", "sheet_id": "SHEETID"}'

字段管理

**添加字段** —— 向子表添加一个或多个字段。单个子表最多 150 个字段。

wecom-cli doc smartsheet_add_fields '{"docid": "DOCID", "sheet_id": "SHEETID", "fields": [{"field_title": "任务名称", "field_type": "FIELD_TYPE_TEXT"}]}'

在添加字段前,请先参阅所有字段类型和定义 [字段类型参考](references/smartsheet-field-types.md)。

> 注意:如果是首次创建表并调用这个方法添加字段的情况下,调用本接口前,你必须确认已完成以下操作,否则会多出一个无用的默认列: > 1. 已调用 `smartsheet_get_fields` 查看子表现有字段(新子表会自带一个默认文本字段) > 2. 已调用 `smartsheet_update_fields` 将该默认字段重命名为你需要的第一个字段名,然后在本接口中只传入剩余的字段(不包含第一个字段)。

**更新字段标题** —— **只能改名,不能改类型**(`field_type` 必须传原始类型)。`field_title` 不能更新为原值。

wecom-cli doc smartsheet_update_fields '{"docid": "DOCID", "sheet_id": "SHEETID", "fields": [{"field_id": "FIELDID", "field_title": "新标题", "field_type": "FIELD_TYPE_TEXT"}]}'

**删除字段** —— 删除一列或多列字段,**操作不可逆**。`field_id` 可通过 `smartsheet_get_fields` 获取。

wecom-cli doc smartsheet_delete_fields '{"docid": "DOCID", "sheet_id": "SHEETID", "field_ids": ["FIELDID"]}'

---

三、智能表格数据管理

查询记录

查询子表全部记录。

# 通过 docid
wecom-cli doc smartsheet_get_records '{"docid": "DOCID", "sheet_id": "SHEETID"}'
# 或通过 URL
wecom-cli doc smartsheet_get_records '{"url": "https://doc.weixin.qq.com/smartsheet/xxx", "sheet_id": "SHEETID"}'

参见 [API 详情](references/smartsheet-get-records.md)。

添加记录(不带图片或文件)

添加一行或多行记录,单次建议 500 行内。

**调用前**必须先了解目标表的字段类型(通过 `smartsheet_get_fields`),重点关注 `field_type`。对于单选/多选(Option)字段,需注意匹配已有选项的 `id`。

wecom-cli doc smartsheet_add_records '{"docid": "DOCID", "sheet_id": "SHEETID", "records": [{"values": {"任务名称": [{"type": "text", "text": "完成需求文档"}], "优先级": [{"text": "高"}]}}]}'

各字段类型的值格式参见 [单元格值格式参考](references/smartsheet-cell-value-formats.md)。

添加记录(带图片或文件)

添加一行或多行记录,单次建议 500 行内。与 `smartsheet_add_records` 不同之处在于,可支持本地路径传入图片、文件。对于需要添加带图片或文件的记录,请使用此接口。传入后台后,后台将自动存储并转换为 `image_url`。

wecom-cli doc +smartsheet_add_records_auto_file '{"docid":"DOCID","sheet_id":"SHEETID","records":[{"values":{"图片":[{"image_path":"/path/to/image.jpg"}],"文件":[{"file_path":"/path/to/file.txt"}]}}]}'

更新记录(不带图片或文件)

更新一行或多行记录,单次建议在 500 行内。需提供 `record_id`(通过 `smartsheet_get_records` 获取)。支持通过 `key_type` 指定 values 的 key 使用字段标题或字段 ID:

  • `CELL_VALUE_KEY_TYPE_FIELD_TITLE`:key 为字段标题
  • `CELL_VALUE_KEY_TYPE_FIELD_ID`:key 为字段 ID
wecom-cli doc smartsheet_update_records '{"docid": "DOCID", "sheet_id": "SHEETID", "key_type": "CELL_VALUE_KEY_TYPE_FIELD_TITLE", "records": [{"record_id": "RECORDID", "values": {"任务名称": [{"type": "text", "text": "更新后的内容"}]}}]}'

**注意**:创建时间、最后编辑时间、创建人、最后编辑人字段不可更新。

更新记录(更新图片或文件字段)

更新一行或多行记录,单次建议在 500 行内。与 `smartsheet_update_records` 不同之处在于,可支持本地路径传入图片、文件。对于需要更新记录中的图片或文件,请使用此接口。传入后台后,后台将自动存储并转换为 `image_url`。

wecom-cli doc +smartsheet_update_records_aut
Read more
Ships withwecom-cli

💬 扫码加入企业微信交流群: 企业微信命令行工具 — 让人类和 AI Agent 都能在终端中操作企业微信。

Get the whole plugin
Stats
2,636
Stars
175
Forks
Maintained
Maintenance
Rust
Language
MIT
License
1mo ago
Last commit
4mo ago
Created

Repo: wecomteam/wecom-cli

Other skills on wecom-cli.