
Lark Drive
Upload, download, and organize Feishu cloud drive files and folders,Import local Word, Markdown, Excel, CSV, or .base into docx, sheet, or bitable,Search drive/Wiki objects with natural-language-style
Install
npx skills add https://github.com/larksuite/cli --skill lark-driveWhat is this skill?
- Import routing: bitable from xlsx/csv/.base, docx from md/docx, sheets from spreadsheets
- drive +search as preferred doc/Wiki discovery path
- Version history get, revert, and delete with user or bot identity
Adoption & trust: 209k installs on skills.sh; 13.7k GitHub stars; 3/3 security scanners passed (skills.sh audits).
Recommended Skills
Journey fit
Drive import, search, and document lifecycle tie into connecting local assets and automation to Feishu cloud APIs—classic integration work during product build and content pipelines. Commands wrap Drive/Wiki/import/version APIs and routing rules (e.g. bitable import via drive before lark-base), which is third-party platform integration.
Common Questions / FAQ
Is Lark Drive safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Lark Drive
# drive (v1) **CRITICAL — 开始前 MUST 先用 Read 工具读取 [`../lark-shared/SKILL.md`](../lark-shared/SKILL.md),其中包含认证、权限处理** > **导入分流规则:** 如果用户要把本地 Excel / CSV / `.base` 快照导入成 Base / 多维表格 / bitable,必须优先使用 `lark-cli drive +import --type bitable`。不要先切到 `lark-base`;`lark-base` 只负责导入完成后的表内操作。 ## 快速决策 - 用户要**搜文档 / Wiki / 电子表格 / 多维表格 / 云空间对象**,优先使用 `lark-cli drive +search`。自然语言里"最近我编辑过的"、"我创建的"、"最近一周我打开过的 xxx"、"某人创建的 docx" 等直接映射到扁平 flag,避免手写嵌套 JSON。老的 `docs +search` 进入维护期、后续会下线,不要新增对它的依赖。 - 用户要把本地 `.xlsx` / `.csv` / `.base` 导入成 Base / 多维表格 / bitable,第一步必须使用 `lark-cli drive +import --type bitable`。 - 用户要把本地 `.md` / `.docx` / `.doc` / `.txt` / `.html` 导入成在线文档,使用 `lark-cli drive +import --type docx`。 - 用户要在 Drive 里上传、创建、读取、局部 patch 或覆盖更新**原生 `.md` 文件**(不是导入成 docx),切到 [`lark-markdown`](../lark-markdown/SKILL.md)。 - 用户要查看、下载、回滚或删除文件的**历史版本**,使用 `drive +version-history`、`drive +version-get`、`drive +version-revert`、`drive +version-delete`;这组命令同时支持 `--as user` 和 `--as bot`,自动化场景优先 `--as bot`。 - 用户要把本地 `.xlsx` / `.xls` / `.csv` 导入成电子表格,使用 `lark-cli drive +import --type sheet`。 - 用户要在云空间里新建文件夹,优先使用 `lark-cli drive +create-folder`。 - 用户要把本地文件上传到知识库 / 文档库里的某个 wiki 节点下时,仍然使用 `lark-cli drive +upload --wiki-token <wiki_token>`;不要误切到 `wiki` 域命令。 - `lark-base` 只负责导入完成后的 Base 内部操作(表、字段、记录、视图),不要在“本地文件 -> Base”这一步提前切到 `lark-base`。 ## 修改标题 - 使用 `drive files patch` 命令,通过new_title字段可以修改标题,支持 docx、sheet、bitable、file、wiki、folder 类型 ## 核心概念 ### 文档类型与 Token 飞书开放平台中,不同类型的文档有不同的 URL 格式和 Token 处理方式。在进行文档操作(如添加评论、下载文件等)时,必须先获取正确的 `file_token`。 ### 文档 URL 格式与 Token 处理 | URL 格式 | 示例 | Token 类型 | 处理方式 | |----------|---------------------------------------------------------|-----------|----------| | `/docx/` | `https://example.larksuite.com/docx/doxcnxxxxxxxxx` | `file_token` | URL 路径中的 token 直接作为 `file_token` 使用 | | `/doc/` | `https://example.larksuite.com/doc/doccnxxxxxxxxx` | `file_token` | URL 路径中的 token 直接作为 `file_token` 使用 | | `/wiki/` | `https://example.larksuite.com/wiki/wikcnxxxxxxxxx` | `wiki_token` | ⚠️ **不能直接使用**,需要先查询获取真实的 `obj_token` | | `/sheets/` | `https://example.larksuite.com/sheets/shtcnxxxxxxxxx` | `file_token` | URL 路径中的 token 直接作为 `file_token` 使用 | | `/drive/folder/` | `https://example.larksuite.com/drive/folder/fldcnxxxx` | `folder_token` | URL 路径中的 token 作为文件夹 token 使用 | ### Wiki 链接特殊处理(关键!) 知识库链接(`/wiki/TOKEN`)背后可能是云文档、电子表格、多维表格等不同类型的文档。**不能直接假设 URL 中的 token 就是 file_token**,必须先查询实际类型和真实 token。 #### 处理流程 1. **使用 `wiki.spaces.get_node` 查询节点信息** ```bash lark-cli wiki spaces get_node --params '{"token":"wiki_token"}' ``` 2. **从返回结果中提取关键信息** - `node.obj_type`:文档类型(docx/doc/sheet/bitable/slides/file/mindnote) - `node.obj_token`:**真实的文档 token**(用于后续操作) - `node.title`:文档标题 3. **根据 `obj_type` 使用对应的 API** | obj_type | 说明 | 使用的 API | |----------|------|-----------| | `docx` | 新版云文档 | `drive file.comments.*`、`docx.*` | | `doc` | 旧版云文档 | `drive file.comments.*` | | `sheet` | 电子表格 | `sheets.*` | | `bitable` | 多维表格 | `bitable.*` | | `slides` | 幻灯片 | `drive.*` | | `file` | 文件 | `drive.*` | | `mindnote` | 思维导图 | `drive.*` | #### 查询示例 ```bash # 查询 wiki 节点 lark-cli wiki spaces get_node --params '{"token":"wiki_token"}' ``` 返回结果示例: ```json { "node": { "obj_type": "docx", "obj_token": "xxxx", "title": "标题", "node_type": "origin", "space_id": "12345678910" } } ``` ### 资源关系 ``` Wiki Space (知识空间) └── Wiki Node (知识库节点) ├── obj_type: docx (新版文档) │ └── obj_token (真实文档 token) ├── obj_type: d