Install
openclaw skills install feishu-document-readerRead and extract content from all Feishu (Lark) document types using the official Feishu Open API
openclaw skills install feishu-document-readerThis skill enables reading and extracting content from all Feishu (Lark) document types using the official Feishu Open API.
./reference/feishu_config.json with your Feishu app credentials:{
"app_id": "your_feishu_app_id_here",
"app_secret": "your_feishu_app_secret_here"
}
chmod +x scripts/read_doc.sh
chmod +x scripts/read_feishu.sh
chmod +x scripts/get_blocks.sh
Security Note: The configuration file should be kept secure and not committed to version control. Consider using proper file permissions (chmod 600 ./reference/feishu_config.json).
使用统一文档读取器可以自动识别并读取所有支持的文档类型:
# 自动识别文档类型并读取
./scripts/read_feishu.sh "docx_xxxxxxxxxxxxxx"
./scripts/read_feishu.sh "sheet_xxxxxxxxxxxxx"
./scripts/read_feishu.sh "basexxxxxxxxxxxxxx"
./scripts/read_feishu.sh "wikcnxxxxxxxxxxxxx"
# 从URL直接读取
./scripts/read_feishu.sh "https://xxx.feishu.cn/docx/xxxxx"
# 指定文档类型
./scripts/read_feishu.sh "token" --type bitable
# 格式化JSON输出
./scripts/read_feishu.sh "token" --pretty
# 只输出文本内容
./scripts/read_feishu.sh "docx_token" --output text
读取飞书知识库节点和内容:
# 读取单个Wiki节点
./scripts/read_feishu.sh "wikcnxxxxxxxxxxxxxx" --type wiki
# 读取整个知识空间
./scripts/read_feishu.sh --wiki-space "SPACE_ID"
# 递归读取所有子节点内容
./scripts/read_feishu.sh --wiki-space "SPACE_ID" --recursive
读取飞书多维表格数据:
# 读取多维表格(包含所有数据表和记录)
./scripts/read_feishu.sh "basexxxxxxxxxxxxxx" --type bitable
# 读取新版文档
./scripts/read_doc.sh "docx_xxxxxxxxxxxxxx"
# 读取电子表格
./scripts/read_doc.sh "sheet_xxxxxxxxxxxxx" sheet
# 读取多维表格
./scripts/read_doc.sh "basexxxxxxxxxxxxxx" bitable
# 读取知识库节点
./scripts/read_doc.sh "wikcnxxxxxxxxxxxxx" wiki
For complete document structure with all blocks:
# Get full document blocks structure
./scripts/get_blocks.sh "docx_AbCdEfGhIjKlMnOpQrStUv"
Using Python directly:
python scripts/feishu_reader.py "docx_token" --pretty
python scripts/feishu_reader.py "sheet_token" --type sheet
python scripts/feishu_reader.py --wiki-space "SPACE_ID" --recursive
| 类型 | Token前缀 | 说明 | 支持程度 |
|---|---|---|---|
| docx | docx_ | 新版飞书文档 | ✅ 完整支持 |
| doc | doc_ | 旧版飞书文档 | ✅ 基本支持 |
| sheet | sheet_, shtcn | 电子表格 | ✅ 完整支持 |
| bitable | base, bascn | 多维表格 | ✅ 完整支持 |
| wiki | wikcn | 知识库节点 | ✅ 完整支持 |
| slides | - | 幻灯片 | ⚠️ 仅元数据 |
# Python script options
python scripts/read_feishu_doc.py --help
# Shell script usage
./scripts/read_doc.sh <doc_token> [doc|sheet|slide]
# Get full document blocks
./scripts/get_blocks.sh <doc_token>
# Get specific block
./scripts/get_blocks.sh <doc_token> <block_id>
# Include children blocks
./scripts/get_blocks.sh <doc_token> "" true
# Python options
python scripts/get_feishu_doc_blocks.py --help
Your Feishu app needs the following permissions based on document types:
docx:document:readonly - 读取新版文档内容doc:document:readonly - 读取旧版文档内容sheets:spreadsheet:readonly - 读取电子表格内容bitable:app:readonly - 读取多维表格元信息bitable:record:read - 读取多维表格记录wiki:wiki:readonly - 读取知识库节点信息drive:drive:readonly - 读取云空间文件信息Common errors and solutions:
wiki:wiki:readonly 权限bitable:record:read 权限# 新版文档 (docx)
./scripts/read_feishu.sh "docx_AbCdEfGhIjKlMnOp" --pretty
# 电子表格 (sheet)
./scripts/read_feishu.sh "sheet_XyZ123AbCdEfGh" --type sheet
# 多维表格 (bitable)
./scripts/read_feishu.sh "baseAbCdEfGhIjKlMn" --type bitable --pretty
# 知识库节点 (wiki)
./scripts/read_feishu.sh "wikcnAbCdEfGhIjKl" --type wiki
# 读取单个节点及其内容
./scripts/read_feishu.sh "wikcnAbCdEfGhIjKl" --type wiki --pretty
# 读取整个知识空间
./scripts/read_feishu.sh --wiki-space "7xxxxxxxxxx" --pretty
# 递归读取知识空间所有内容
./scripts/read_feishu.sh --wiki-space "7xxxxxxxxxx" --recursive
# 直接从飞书URL读取(自动识别类型)
./scripts/read_feishu.sh "https://xxx.feishu.cn/docx/xxxxx"
./scripts/read_feishu.sh "https://xxx.feishu.cn/wiki/xxxxx"
./scripts/read_feishu.sh "https://xxx.feishu.cn/base/xxxxx"
# JSON格式(默认)
./scripts/read_feishu.sh "docx_token"
# 格式化JSON
./scripts/read_feishu.sh "docx_token" --pretty
# 仅输出纯文本
./scripts/read_feishu.sh "docx_token" --output text
# 统一读取器
python scripts/feishu_reader.py "docx_token" --pretty
python scripts/feishu_reader.py "base_token" --type bitable
python scripts/feishu_reader.py --wiki-space "SPACE_ID" --recursive
# 文档blocks专用
python scripts/get_feishu_doc_blocks.py "docx_token"
chmod 600)test_auth.py script to verify credentialsdocx_, doc_, or sheet_)open.feishu.cn--include-children flag for complete block tree