wecomcli-manage-smartsheet-data
wecomteam/wecom-cli
Manage WeChat Work smartsheet records with CRUD operations via CLI.
What is wecomcli-manage-smartsheet-data?
Provides command-line tools to read, create, update, and delete records in WeChat Work smartsheets. Use this when you need to query table data, add new rows, modify existing records, or remove rows from a smartsheet document.
- Query all records from a smartsheet by sheet ID
- Add single or multiple records (up to 500 per operation)
- Update existing records with new field values
- Delete records (irreversible operation)
- Locate documents by docid or document URL
- Support for various field types including text, options, and user references
How to install wecomcli-manage-smartsheet-data
npx skills add https://github.com/wecomteam/wecom-cli --skill wecomcli-manage-smartsheet-data- wecom-cli binary installed and available in PATH
- Valid docid or smartsheet document URL
- sheet_id of the target sheet
- For USER-type fields: use wecomcli-lookup-contact skill to resolve usernames to user IDs first
How to use wecomcli-manage-smartsheet-data
- 1.Run wecom-cli doc smartsheet_get_records to retrieve all records and understand the data structure
- 2.For add/update operations, first call smartsheet_get_fields to identify field types and option IDs
- 3.For USER fields, use wecomcli-lookup-contact's get_userlist to convert names to user IDs
- 4.Call smartsheet_add_records with properly formatted field values (up to 500 rows per call)
- 5.Call smartsheet_update_records with record_id and updated values for modifications
- 6.Call smartsheet_delete_records with record_ids to remove rows (operation is irreversible)
Use cases
- Bulk import task data into a project tracking smartsheet
- Update status or priority fields for multiple records at once
- Query all records to display current table state or filter data
- Remove completed or obsolete records from a smartsheet
- Populate smartsheet with user assignments by looking up employee IDs
- Enterprise WeChat users managing smartsheet documents
- Teams automating data entry or bulk updates
- Developers building WeChat Work integrations
- Project managers tracking tasks or records in smartsheets
wecomcli-manage-smartsheet-data FAQ
No. Fields like creation time, last edit time, creator, and last editor are read-only and cannot be modified.
The recommended limit is 500 records per operation. Larger batches should be split into multiple calls.
You must use the user's userid, not their name. First use wecomcli-lookup-contact's get_userlist to find the userid by name, then include it in the field value.
Yes. All record operations support either docid or a full smartsheet document URL (https://doc.weixin.qq.com/smartsheet/...) to locate the document.
The API returns an errcode (non-zero) and errmsg. You should retry once; if it fails again, display the error code and message to the user.
Full instructions (SKILL.md)
Source of truth, from wecomteam/wecom-cli.
name: wecomcli-manage-smartsheet-data description: 企业微信智能表格数据(记录)管理技能。提供智能表格记录的增删改查能力。适用场景:(1) 查询子表全部记录 (2) 添加一行或多行记录 (3) 更新已有记录 (4) 删除记录。当用户需要读取表格数据、写入新数据、修改或删除表格行时触发此 Skill。支持通过 docid 或文档 URL 定位文档。 metadata: requires: bins: ["wecom-cli"] cliHelp: "wecom-cli doc --help"
企业微信智能表格数据管理
wecom-cli是企业微信提供的命令行程序,所有操作通过执行wecom-cli命令完成。
管理智能表格中的记录(行数据)。所有接口支持通过 docid 或 url 二选一定位文档。
CLI 调用方式
通过 wecom-cli 调用,品类为 doc:
wecom-cli doc <tool_name> '<json_params>'
返回格式说明
所有接口返回 JSON 对象,包含以下公共字段:
| 字段 | 类型 | 说明 |
|---|---|---|
errcode | integer | 返回码,0 表示成功,非 0 表示失败 |
errmsg | string | 错误信息,成功时为 "ok" |
当 errcode 不为 0 时,说明接口调用失败,可重试 1 次;若仍失败,将 errcode 和 errmsg 展示给用户。
smartsheet_get_records
查询子表全部记录。
- 通过 sheetid:
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 详情。
smartsheet_add_records
添加一行或多行记录,单次建议 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": "高"}]}}]}'
各字段类型的值格式参见 单元格值格式参考。
smartsheet_update_records
更新一行或多行记录,单次建议在 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": "更新后的内容"}]}}]}'
注意:创建时间、最后编辑时间、创建人、最后编辑人字段不可更新。
smartsheet_delete_records
删除一行或多行记录,单次必须在 500 行内。操作不可逆。record_id 通过 smartsheet_get_records 获取。
wecom-cli doc smartsheet_delete_records '{"docid": "DOCID", "sheet_id": "SHEETID", "record_ids": ["RECORDID1", "RECORDID2"]}'
典型工作流
- 读取数据 →
wecom-cli doc smartsheet_get_records '{"docid":"DOCID","sheet_id":"SHEETID"}'
- 写入数据 → 先
smartsheet_get_fields了解列类型 → 若涉及成员(USER)字段,先通过wecomcli-lookup-contact的get_userlist查找人员 userid →smartsheet_add_records写入 - 更新数据 → 先
smartsheet_get_records获取 record_id → 若涉及成员(USER)字段,先通过wecomcli-lookup-contact的get_userlist查找人员 userid →smartsheet_update_records更新 - 删除数据 → 先
smartsheet_get_records确认 record_id →smartsheet_delete_records删除
注意:成员(USER)类型字段需要填写
user_id,不能直接使用姓名。必须先通过wecomcli-lookup-contact技能的get_userlist接口按姓名查找到对应的userid后再使用。
Related skills
More from wecomteam/wecom-cli and the wider catalog.

wecomcli-manage-smartsheet-schema
Manage WeChat Work smartsheet structure: add, update, delete sheets and fields via CLI.

wecomcli-meeting
Create, manage, and query WeCom enterprise meetings with full control over participants and settings.

wecomcli-msg
Query WeChat Work conversations, retrieve message history with media support, and send text messages.

wecomcli-schedule
Manage WeCom enterprise calendar schedules: query, create, modify, and coordinate availability.

wecomcli-smartsheet
Manage WeCom smartsheet structure and data via CLI—create sheets, fields, and records.

wecomcli-todo
Manage WeChat Work todo items: query, create, update, delete, and track completion status.