wecomcli-sheet

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

企业微信在线表格管理

WeCom Online Sheet Management

wecom-cli
是企业微信提供的命令行程序,所有操作通过执行
wecom-cli
命令完成。
资源型技能,负责在线表格
/sheet/*
)的新建、内容读写以及子工作表管理。
wecom-cli
is a command-line program provided by WeCom, all operations are completed by executing
wecom-cli
commands.
This is a resource-based skill responsible for creating, reading/writing content, and managing sub-sheets of Online Sheets (
/sheet/*
).

调用方式

Calling Method

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

接口路由表

Interface Routing Table

硬规则:第二列是
references/xxx.md
链接的,命中这一行后
read
对应 references 文件,再构造命令
。写入/读取子表数据前,先用
sheet_get_info
拿到目标子表的
sheet_id
用户意图参考位置
读取在线表格完整内容(Markdown 概览)见下方「读取完整内容」
读取在线表格基础信息与子表列表见下方「读取基础信息」
从零新建在线表格(空白)见下方「新建在线表格」
修改在线表格指定区域内容references/sheet-update-range-data.md
在线表格末尾追加一行数据references/sheet-append-data.md
添加在线表格子工作表references/sheet-add-sub.md
删除在线表格子工作表references/sheet-delete-sub.md
Hard Rule: If the second column is a link to
references/xxx.md
, after hitting this row, first
read
the corresponding references file, then construct the command
. Before writing/reading sub-sheet data, use
sheet_get_info
to get the
sheet_id
of the target sub-sheet first.
User IntentReference Location
Read complete content of Online Sheet (Markdown overview)See "Read Complete Content" below
Read basic information and sub-sheet list of Online SheetSee "Read Basic Information" below
Create an Online Sheet from scratch (blank)See "Create Online Sheet" below
Modify content in specified range of Online Sheetreferences/sheet-update-range-data.md
Append a row of data at the end of Online Sheetreferences/sheet-append-data.md
Add sub-sheet to Online Sheetreferences/sheet-add-sub.md
Delete sub-sheet from Online Sheetreferences/sheet-delete-sub.md

接口详述

Interface Details

新建在线表格

Create Online Sheet

从零新建一篇企微在线表格:空白。创建成功后返回
docid
url
命令
bash
wecom-cli doc create_doc '<JSON 参数>'
参数
参数类型必填默认值说明
doc_type
int固定传
4
(在线表格)
doc_name
string表格标题
注意事项
  • 本接口仅创建空白在线表格,不支持携带初始内容;如需写入数据,请在创建后先用
    sheet_get_info
    拿到子表
    sheet_id
    ,再通过
    sheet_update_range_data
    /
    sheet_append_data
    写入。
Create a blank WeCom Online Sheet from scratch. Returns
docid
and
url
after successful creation.
Command
bash
wecom-cli doc create_doc '<JSON parameters>'
Parameters
ParameterTypeRequiredDefault ValueDescription
doc_type
intYesFixed value
4
(Online Sheet)
doc_name
stringYesSheet title
Notes
  • This interface only creates blank online sheets, and does not support carrying initial content; if you need to write data, after creation, first use
    sheet_get_info
    to get the sub-sheet
    sheet_id
    , then write via
    sheet_update_range_data
    /
    sheet_append_data
    .

读取完整内容

Read Complete Content

获取在线表格的完整内容数据,统一以 Markdown 格式返回。采用异步轮询机制:首次调用无需传
task_id
,接口返回
task_id
;若
task_done
false
,需携带该
task_id
再次调用,直到
task_done
true
时返回完整内容。适合快速概览或读取整篇表格内容。
命令
bash
wecom-cli doc get_doc_content '<JSON 参数>'
参数
字段类型必填默认值语义
docid
string
url
二选一
在线表格的 docid
url
string
docid
二选一
在线表格的访问链接
type
int内容返回格式,固定传
2
(Markdown)
task_id
string任务 ID,首次不传,轮询时填上次返回的
task_id
返回
字段类型说明
content
string
task_done
true
时返回的完整 Markdown 内容
task_id
string任务 ID,未完成时用于下次轮询
task_done
bool任务是否完成,
false
时需携带
task_id
继续轮询
使用规则
  • 首次调用不传
    task_id
    ;若
    task_done
    false
    ,记录
    task_id
    后携带其再次调用,直到
    task_done
    true
    content
Obtain the complete content data of the Online Sheet, returned uniformly in Markdown format. Uses asynchronous polling mechanism: No need to pass
task_id
for the first call, the interface returns
task_id
; if
task_done
is
false
, carry this
task_id
to call again until
task_done
is
true
, then the complete content is returned. Suitable for quick overview or reading the entire sheet content.
Command
bash
wecom-cli doc get_doc_content '<JSON parameters>'
Parameters
FieldTypeRequiredDefault ValueSemantics
docid
stringEither
docid
or
url
is required
docid of the Online Sheet
url
stringEither
docid
or
url
is required
Access link of the Online Sheet
type
intYesContent return format, fixed value
2
(Markdown)
task_id
stringNoTask ID, not passed for the first call, fill in the
task_id
returned last time during polling
Return
FieldTypeDescription
content
stringComplete Markdown content returned when
task_done
is
true
task_id
stringTask ID, used for next polling when not completed
task_done
boolWhether the task is completed; when
false
, carry
task_id
to continue polling
Usage Rules
  • Do not pass
    task_id
    for the first call; if
    task_done
    is
    false
    , record the
    task_id
    and carry it to call again until
    task_done
    is
    true
    to retrieve
    content
    .

读取基础信息

Read Basic Information

读取在线表格的基础信息,包括工作表列表、文档名称与访问链接。所有后续需要
sheet_id
的接口(
sheet_update_range_data
/
sheet_append_data
/
sheet_delete_sub
等)的
sheet_id
都从本接口返回的
sheets[]
中取。
命令
bash
wecom-cli doc sheet_get_info '<JSON 参数>'
参数
字段类型必填默认值语义
docid
string
url
二选一
在线表格的 docid
url
string
docid
二选一
在线表格的访问链接
返回
字段类型说明
sheets
array工作表列表;每项含
sheet_id
/
title
/
row_count
/
column_count
/
data_range
等基础信息
url
string文档访问链接
name
string文档名称
使用规则
  • docid
    url
    二选一,至少传其一。
  • 读 → 写 链路:当需要往具体子表写内容(
    sheet_update_range_data
    /
    sheet_append_data
    )时,应先用
    get_doc_content
    读取并识别出各子表的标题具体数据,再调用本接口拿到
    sheets[]
    中每个子表的
    sheet_id
    与行列数(
    row_count
    /
    column_count
    );通过子表标题与
    title
    匹配
    确定目标
    sheet_id
    ,并结合行列数核对写入区域范围,从而打通「读 → 写」的完整链路。
Read the basic information of the Online Sheet, including the list of worksheets, document name and access link. The
sheet_id
of all subsequent interfaces that require
sheet_id
(such as
sheet_update_range_data
/
sheet_append_data
/
sheet_delete_sub
) is obtained from the
sheets[]
returned by this interface.
Command
bash
wecom-cli doc sheet_get_info '<JSON parameters>'
Parameters
FieldTypeRequiredDefault ValueSemantics
docid
stringEither
docid
or
url
is required
docid of the Online Sheet
url
stringEither
docid
or
url
is required
Access link of the Online Sheet
Return
FieldTypeDescription
sheets
arrayList of worksheets; each item contains basic information such as
sheet_id
/
title
/
row_count
/
column_count
/
data_range
url
stringDocument access link
name
stringDocument name
Usage Rules
  • Either
    docid
    or
    url
    is required, at least one must be passed.
  • Read → Write Link: When you need to write content to a specific sub-sheet (
    sheet_update_range_data
    /
    sheet_append_data
    ), you should first use
    get_doc_content
    to read and identify the title and specific data of each sub-sheet, then call this interface to get the
    sheet_id
    and row/column counts (
    row_count
    /
    column_count
    ) of each sub-sheet in
    sheets[]
    ; determine the target
    sheet_id
    by matching the sub-sheet title with
    title
    , and check the write area range combined with the row/column counts, thus opening up the complete "Read → Write" link.

跨技能依赖

Cross-Skill Dependencies

依赖技能典型协作场景数据流向
wecomcli-contact
表格里需要写入人员信息时按姓名查 userid
get_userlist
查到 userid → 本 skill 写入
wecomcli-msg
用户要求把在线表格链接发给某人/某群本 skill 新建后返回
url
wecomcli-msg
发送链接
Dependent SkillTypical Collaboration ScenarioData Flow
wecomcli-contact
When personnel information needs to be written into the sheet, query userid by name
get_userlist
retrieves userid → this skill writes
wecomcli-msg
When the user requests to send the Online Sheet link to someone/some groupThis skill returns
url
after creation →
wecomcli-msg
sends the link