wecomcli-manage-smartsheet-schema

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

企业微信智能表格结构管理

WeCom Smart Table Structure Management

wecom-cli
是企业微信提供的命令行程序,所有操作通过执行
wecom-cli
命令完成。
管理智能表格的子表和字段(列)结构。所有接口支持通过
docid
url
二选一定位文档。
wecom-cli
is a command-line program provided by WeCom, all operations are completed by executing
wecom-cli
commands.
Manage the structure of sub-sheets and fields (columns) of smart tables. All interfaces support locating documents by either
docid
or
url
.

调用方式

Invocation Method

通过
wecom-cli
调用,品类为
doc
bash
wecom-cli doc <tool_name> '<json_params>'
Invoke via
wecom-cli
, the category is
doc
:
bash
wecom-cli doc <tool_name> '<json_params>'

返回格式说明

Return Format Description

所有接口返回 JSON 对象,包含以下公共字段:
字段类型说明
errcode
integer返回码,
0
表示成功,非
0
表示失败
errmsg
string错误信息,成功时为
"ok"
errcode
不为
0
时,说明接口调用失败,可重试 1 次;若仍失败,将
errcode
errmsg
展示给用户。
All interfaces return JSON objects, containing the following common fields:
FieldTypeDescription
errcode
integerReturn code,
0
indicates success, non-
0
indicates failure
errmsg
stringError message, it is
"ok"
when the request succeeds
When
errcode
is not
0
, it means the interface call failed, you can retry once; if it still fails, display
errcode
and
errmsg
to the user.

子表管理

Sub-sheet Management

smartsheet_get_sheet

smartsheet_get_sheet

查询文档中所有子表信息,返回 sheet_id、title、类型等。
bash
wecom-cli doc smartsheet_get_sheet '{"docid": "DOCID"}'
Query all sub-sheet information in the document, return sheet_id, title, type, etc.
bash
wecom-cli doc smartsheet_get_sheet '{"docid": "DOCID"}'

smartsheet_add_sheet

smartsheet_add_sheet

添加空子表。新子表不含视图、记录和字段,需通过其他接口补充。
bash
wecom-cli doc smartsheet_add_sheet '{"docid": "DOCID", "properties": {"title": "新子表"}}'
注意:新建智能表格文档默认已含一个子表,仅需多个子表时调用。
Add an empty sub-sheet. The new sub-sheet does not contain views, records and fields, which need to be supplemented through other interfaces.
bash
wecom-cli doc smartsheet_add_sheet '{"docid": "DOCID", "properties": {"title": "新子表"}}'
Note: A newly created smart table document contains one sub-sheet by default, call this interface only when you need multiple sub-sheets.

smartsheet_update_sheet

smartsheet_update_sheet

修改子表标题。需提供 sheet_id 和新 title。
bash
wecom-cli doc smartsheet_update_sheet '{"docid": "DOCID", "sheet_id": "SHEETID", "title": "新标题"}'
Modify the sub-sheet title. You need to provide sheet_id and the new title.
bash
wecom-cli doc smartsheet_update_sheet '{"docid": "DOCID", "sheet_id": "SHEETID", "title": "新标题"}'

smartsheet_delete_sheet

smartsheet_delete_sheet

永久删除子表,操作不可逆
bash
wecom-cli doc smartsheet_delete_sheet '{"docid": "DOCID", "sheet_id": "SHEETID"}'
Permanently delete the sub-sheet, operation is irreversible.
bash
wecom-cli doc smartsheet_delete_sheet '{"docid": "DOCID", "sheet_id": "SHEETID"}'

字段管理

Field Management

smartsheet_get_fields

smartsheet_get_fields

查询子表的所有字段信息,返回 field_id、field_title、field_type。
bash
wecom-cli doc smartsheet_get_fields '{"docid": "DOCID", "sheet_id": "SHEETID"}'
Query all field information of the sub-sheet, return field_id, field_title, field_type.
bash
wecom-cli doc smartsheet_get_fields '{"docid": "DOCID", "sheet_id": "SHEETID"}'

smartsheet_add_fields

smartsheet_add_fields

向子表添加一个或多个字段。单个子表最多 150 个字段。
bash
wecom-cli doc smartsheet_add_fields '{"docid": "DOCID", "sheet_id": "SHEETID", "fields": [{"field_title": "任务名称", "field_type": "FIELD_TYPE_TEXT"}]}'
支持的字段类型参见 字段类型参考
Add one or more fields to the sub-sheet. A single sub-sheet supports up to 150 fields.
bash
wecom-cli doc smartsheet_add_fields '{"docid": "DOCID", "sheet_id": "SHEETID", "fields": [{"field_title": "任务名称", "field_type": "FIELD_TYPE_TEXT"}]}'
For supported field types, see Field Type Reference.

smartsheet_update_fields

smartsheet_update_fields

更新字段标题。只能改名,不能改类型(field_type 必须传原始类型)。field_title 不能更新为原值。
bash
wecom-cli doc smartsheet_update_fields '{"docid": "DOCID", "sheet_id": "SHEETID", "fields": [{"field_id": "FIELDID", "field_title": "新标题", "field_type": "FIELD_TYPE_TEXT"}]}'
Update the field title. Only renaming is allowed, type cannot be modified (the original field_type must be passed). The field_title cannot be updated to the original value.
bash
wecom-cli doc smartsheet_update_fields '{"docid": "DOCID", "sheet_id": "SHEETID", "fields": [{"field_id": "FIELDID", "field_title": "新标题", "field_type": "FIELD_TYPE_TEXT"}]}'

smartsheet_delete_fields

smartsheet_delete_fields

删除一列或多列字段,操作不可逆。field_id 可通过
smartsheet_get_fields
获取。
bash
wecom-cli doc smartsheet_delete_fields '{"docid": "DOCID", "sheet_id": "SHEETID", "field_ids": ["FIELDID"]}'
Delete one or more columns of fields, operation is irreversible. The field_id can be obtained via
smartsheet_get_fields
.
bash
wecom-cli doc smartsheet_delete_fields '{"docid": "DOCID", "sheet_id": "SHEETID", "field_ids": ["FIELDID"]}'

典型工作流

Typical Workflow

  1. 了解表结构
bash
wecom-cli doc smartsheet_get_sheet
bash
wecom-cli doc smartsheet_get_fields
  1. 创建表结构
    smartsheet_add_sheet
    添加子表 →
    smartsheet_add_fields
    定义列
  2. 修改表结构
    smartsheet_update_fields
    改列名 /
    smartsheet_delete_fields
    删列
  1. Understand table structure
bash
wecom-cli doc smartsheet_get_sheet
bash
wecom-cli doc smartsheet_get_fields
  1. Create table structure → Add sub-sheet with
    smartsheet_add_sheet
    → Define columns with
    smartsheet_add_fields
  2. Modify table structure → Rename columns with
    smartsheet_update_fields
    / Delete columns with
    smartsheet_delete_fields