wecomcli-manage-smartsheet-data
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese企业微信智能表格数据管理
WeCom Smart Table Data Management
是企业微信提供的命令行程序,所有操作通过执行wecom-cli命令完成。wecom-cli
管理智能表格中的记录(行数据)。所有接口支持通过 或 二选一定位文档。
docidurlis a command line program provided by WeCom, and all operations are completed by executing thewecom-clicommand.wecom-cli
Manage records (row data) in smart tables. All interfaces support locating documents by either or .
docidurlCLI 调用方式
CLI Calling Method
通过 调用,品类为 :
wecom-clidocbash
wecom-cli doc <tool_name> '<json_params>'Called via , with the category as :
wecom-clidocbash
wecom-cli doc <tool_name> '<json_params>'返回格式说明
Return Format Description
所有接口返回 JSON 对象,包含以下公共字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| integer | 返回码, |
| string | 错误信息,成功时为 |
当 不为 时,说明接口调用失败,可重试 1 次;若仍失败,将 和 展示给用户。
errcode0errcodeerrmsgAll interfaces return JSON objects, including the following public fields:
| Field | Type | Description |
|---|---|---|
| integer | Return code, |
| string | Error message, which is |
When is not , it means the interface call failed, you can retry once; if it still fails, display the and to the user.
errcode0errcodeerrmsgsmartsheet_get_records
smartsheet_get_records
查询子表全部记录。
bash
wecom-cli doc smartsheet_get_records '{"docid": "DOCID", "sheet_id": "SHEETID"}'- 或通过 URL:
bash
wecom-cli doc smartsheet_get_records '{"url": "https://doc.weixin.qq.com/smartsheet/xxx", "sheet_id": "SHEETID"}'参见 API 详情。
Query all records of the sub-table.
bash
wecom-cli doc smartsheet_get_records '{"docid": "DOCID", "sheet_id": "SHEETID"}'- Or via URL:
bash
wecom-cli doc smartsheet_get_records '{"url": "https://doc.weixin.qq.com/smartsheet/xxx", "sheet_id": "SHEETID"}'See API Details.
smartsheet_add_records
smartsheet_add_records
添加一行或多行记录,单次建议 500 行内。
调用前必须先了解目标表的字段类型(通过 )。
smartsheet_get_fieldsbash
wecom-cli doc smartsheet_add_records '{"docid": "DOCID", "sheet_id": "SHEETID", "records": [{"values": {"任务名称": [{"type": "text", "text": "完成需求文档"}], "优先级": [{"text": "高"}]}}]}'各字段类型的值格式参见 单元格值格式参考。
Add one or more rows of records, it is recommended to add no more than 500 rows at a time.
Before calling, you must first understand the field types of the target table (via ).
smartsheet_get_fieldsbash
wecom-cli doc smartsheet_add_records '{"docid": "DOCID", "sheet_id": "SHEETID", "records": [{"values": {"任务名称": [{"type": "text", "text": "完成需求文档"}], "优先级": [{"text": "高"}]}}]}'For the value format of each field type, see Cell Value Format Reference.
smartsheet_update_records
smartsheet_update_records
更新一行或多行记录,单次必须在 500 行内。需提供 record_id(通过 获取)。
smartsheet_get_recordsbash
wecom-cli doc smartsheet_update_records '{"docid": "DOCID", "sheet_id": "SHEETID", "records": [{"record_id": "RECORDID", "values": {"任务名称": [{"type": "text", "text": "更新后的内容"}]}}]}'注意:创建时间、最后编辑时间、创建人、最后编辑人字段不可更新。
Update one or more rows of records, no more than 500 rows at a time. You need to provide the record_id (obtained via ).
smartsheet_get_recordsbash
wecom-cli doc smartsheet_update_records '{"docid": "DOCID", "sheet_id": "SHEETID", "records": [{"record_id": "RECORDID", "values": {"任务名称": [{"type": "text", "text": "更新后的内容"}]}}]}'Note: Fields such as creation time, last edit time, creator, and last editor cannot be updated.
smartsheet_delete_records
smartsheet_delete_records
删除一行或多行记录,单次必须在 500 行内。操作不可逆。record_id 通过 获取。
smartsheet_get_recordsbash
wecom-cli doc smartsheet_delete_records '{"docid": "DOCID", "sheet_id": "SHEETID", "record_ids": ["RECORDID1", "RECORDID2"]}'Delete one or more rows of records, no more than 500 rows at a time. The operation is irreversible. The record_id is obtained via .
smartsheet_get_recordsbash
wecom-cli doc smartsheet_delete_records '{"docid": "DOCID", "sheet_id": "SHEETID", "record_ids": ["RECORDID1", "RECORDID2"]}'典型工作流
Typical Workflow
- 读取数据 →
bash
wecom-cli doc smartsheet_get_records '{"docid":"DOCID","sheet_id":"SHEETID"}'- 写入数据 → 先 了解列类型 → 若涉及成员(USER)字段,先通过
smartsheet_get_fields的wecomcli-lookup-contact查找人员 userid →get_userlist写入smartsheet_add_records - 更新数据 → 先 获取 record_id → 若涉及成员(USER)字段,先通过
smartsheet_get_records的wecomcli-lookup-contact查找人员 userid →get_userlist更新smartsheet_update_records - 删除数据 → 先 确认 record_id →
smartsheet_get_records删除smartsheet_delete_records
注意:成员(USER)类型字段需要填写,不能直接使用姓名。必须先通过user_id技能的wecomcli-lookup-contact接口按姓名查找到对应的get_userlist后再使用。userid
- Read data →
bash
wecom-cli doc smartsheet_get_records '{"docid":"DOCID","sheet_id":"SHEETID"}'- Write data → First use to understand the column types → If member (USER) fields are involved, first find the user's userid via the
smartsheet_get_fieldsinterface ofget_userlist→ Write data viawecomcli-lookup-contactsmartsheet_add_records - Update data → First obtain record_id via → If member (USER) fields are involved, first find the user's userid via the
smartsheet_get_recordsinterface ofget_userlist→ Update data viawecomcli-lookup-contactsmartsheet_update_records - Delete data → First confirm the record_id via → Delete data via
smartsheet_get_recordssmartsheet_delete_records
Note: Member (USER) type fields require filling in, and you cannot directly use the name. You must first find the correspondinguser_idby name through theuseridinterface of theget_userlistSkill before using it.wecomcli-lookup-contact