Skip to main content

Export Feishu/Lark cloud documents to Markdown

Project description

feishu-docx

Feishu/Lark Docs、Sheet、Bitable → Markdown | AI Agent-friendly knowledge base exporter with OAuth 2.0, CLI, TUI & Claude Skills support

PyPI version Python 3.11+ License: MIT

中文 | English

feishu-docx TUI

🎯 Why feishu-docx?

Let AI Agents read your Feishu/Lark knowledge base.

  • 🤖 Built for AI — Works seamlessly with Claude/GPT Skills for document retrieval
  • 📄 Full Coverage — Documents, Spreadsheets, Bitables, Wiki nodes
  • 🔐 Authentication — One-time auth, automatic token refresh
  • 🎨 Dual Interface — CLI + Beautiful TUI (Textual-based)
  • 📦 Zero Configpip install and start exporting

⚡ Quick Start (30 seconds)

# Install
pip install feishu-docx

# Configure credentials (one-time)
feishu-docx config set --app-id YOUR_APP_ID --app-secret YOUR_APP_SECRET

# Authorize
feishu-docx auth

# Export!
feishu-docx export "https://my.feishu.cn/wiki/KUIJwaBuGiwaSIkkKJ6cfVY8nSg"

🤖 Claude Skills Support

Enable Claude to access your Feishu knowledge base directly!

This project includes a Claude Skill at .skills/feishu-docx/SKILL.md.

Copy this Skill to your agent project, and Claude can:

  • 📖 Read Feishu knowledge base as context
  • 🔍 Search and reference internal documents
  • 📝 (Planned) Write conversation content back to Feishu

✨ Features

Feature Description
📄 Document Export Docx → Markdown with formatting, images, tables
📊 Spreadsheet Export Sheet → Markdown tables
📋 Bitable Export Multidimensional tables → Markdown
📚 Wiki Export Auto-resolve wiki nodes
🗂️ Wiki Batch Export Recursively export entire wiki space with hierarchy
🗄️ Database Schema Export APaaS database structure to Markdown
🖼️ Auto Image Download Images saved locally with relative paths
🔐 OAuth 2.0 Browser-based auth, token persistence
🎨 Beautiful TUI Terminal UI powered by Textual

✅ Supported Blocks

This tool currently supports exporting the following Feishu/Lark document components:

Category Features Status Notes
Basic Text Headings, Paragraphs, Lists, Tasks (Todo), Code Blocks, Quotes Fully Supported
Formatting Bold, Italic, Strikethrough, Underline, Links, @Mentions Fully Supported
Layout Columns, Callouts, Dividers Fully Supported
Tables Native Tables Export to Markdown/HTML
Media Images, Drawing Boards Drawing boards exported as images
Embedded Spreadsheets (Sheets), Bitable Text content only
Special Synced Blocks ⚠️ Original blocks within the same doc only
Files Attachments File name + download link

📖 Usage

CLI

# Export single document to specific directory
feishu-docx export "https://xxx.feishu.cn/docx/xxx" -o ./docs

# Batch export entire wiki space (preserves hierarchy)
feishu-docx export-wiki-space <space_id_or_url> -o ./wiki_backup --max-depth 5

# Export APaaS database schema
feishu-docx export-workspace-schema <workspace_id> -o ./database_schema.md

# Use token directly
feishu-docx export "URL" -t your_access_token

# Launch TUI
feishu-docx tui

Python API

from feishu_docx import FeishuExporter

# OAuth
exporter = FeishuExporter(app_id="xxx", app_secret="xxx")
path = exporter.export("https://xxx.feishu.cn/wiki/xxx", "./output")

# Or use token directly
exporter = FeishuExporter.from_token("user_access_token")
content = exporter.export_content("https://xxx.feishu.cn/docx/xxx")

🔐 Feishu App Setup

  1. Create app at Feishu Open Platform
  2. Add redirect URL: http://127.0.0.1:9527/
  3. Request permissions:
"docx:document:readonly"  # 查看云文档
"wiki:wiki:readonly"  # 查看知识库
"drive:drive:readonly"  # 查看云空间文件(图片下载)
"sheets:spreadsheet:readonly"  # 查看电子表格
"bitable:app:readonly"  # 查看多维表格
"board:whiteboard:node:read"  # 查看白板
"contact:contact.base:readonly"  # 获取用户基本信息(@用户名称)
"offline_access"  # 离线访问(获取 refresh_token)
  1. Save credentials:
feishu-docx config set --app-id cli_xxx --app-secret xxx

📖 Commands

Command Description
export <URL> Export single document to Markdown
export-wiki-space <space_id> Batch export wiki space with hierarchy
export-workspace-schema <id> Export APaaS database schema
auth OAuth authorization
tui Launch TUI interface
config set Set credentials
config show Show configuration
config clear Clear cache

🗺️ Roadmap

  • Document/Sheet/Wiki export
  • OAuth 2.0 + Token refresh
  • TUI interface
  • Claude Skills support
  • Batch export entire wiki space
  • MCP Server support
  • Write to Feishu (create/update docs)

📜 Changelog

See CHANGELOG.md for version history.


📄 License

MIT License - See LICENSE


⭐ Star this repo if you find it helpful!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

feishu_docx-0.2.0.tar.gz (59.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

feishu_docx-0.2.0-py3-none-any.whl (90.8 kB view details)

Uploaded Python 3

File details

Details for the file feishu_docx-0.2.0.tar.gz.

File metadata

  • Download URL: feishu_docx-0.2.0.tar.gz
  • Upload date:
  • Size: 59.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for feishu_docx-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ab5c0edf1e1ef1bec987b9d340d94c74a86800886e8d23f14ec376ee71813d3b
MD5 6af058ab15535cb905fba6bc15594181
BLAKE2b-256 fc4349a16fa054fb4a38e98ab68e762bfcd2237c413b096d0eaf19e2cb153be4

See more details on using hashes here.

File details

Details for the file feishu_docx-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: feishu_docx-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 90.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for feishu_docx-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f78fc76bac4d5da1852b7b22135a799fbd308b6135ab2b839f9a0a9a2826e4b0
MD5 ad20e38aadb95f18e10e60c9f7bc4f80
BLAKE2b-256 ac4f8aafaeafa70fda7cd4415d66dc098b563e104d01be007be6020edb037bbe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page