Bitable API实战 — 创建表格、批量写入、自动筛选和数据同步
飞书多维表格(Bitable)是字节跳动旗下的在线数据库产品,类似Airtable。OpenClaw深度集成了Bitable API,你可以通过自然语言或工具调用来管理表格、字段和记录。
世界上有一种工具叫多维表格,它就像Excel和数据库的孩子——继承了Excel的易用性,又有了数据库的结构化能力。而OpenClaw,就是让这个孩子学会自己干活的那个老师。
| 工具 | 功能 | 常用场景 |
|---|---|---|
| feishu_bitable_app | 管理多维表格应用 | 创建/删除/复制表格 |
| feishu_bitable_app_table | 管理数据表 | 创建/列出/更新表 |
| feishu_bitable_app_table_field | 管理字段 | 添加/修改/删除列 |
| feishu_bitable_app_table_record | 管理记录 | 增删改查行数据 |
| feishu_bitable_app_table_view | 管理视图 | 创建/切换展示方式 |
feishu_bitable_app({
action: "create",
name: "SEO内容管理看板"
})
返回 app_token,后续所有操作都需要它。
feishu_bitable_app_table({
action: "create",
app_token: "你的app_token",
table: {
name: "内容计划",
fields: [
{ field_name: "标题", type: 1 }, // 文本
{ field_name: "状态", type: 3, property: { // 单选
options: [
{ name: "待写" },
{ name: "写作中" },
{ name: "已发布" }
]
}},
{ field_name: "关键词", type: 4, property: { // 多选
options: [
{ name: "OpenClaw" },
{ name: "Agent Skills" },
{ name: "MCP" }
]
}},
{ field_name: "发布日期", type: 5 }, // 日期
{ field_name: "浏览量", type: 2 }, // 数字
{ field_name: "已完成", type: 7 } // 复选框
]
}
})
feishu_bitable_app_table_record({
action: "batch_create",
app_token: "你的app_token",
table_id: "你的table_id",
records: [
{
fields: {
"标题": "OpenClaw子Agent编排指南",
"状态": "待写",
"关键词": ["OpenClaw", "Agent Skills"],
"浏览量": 0,
"已完成": false
}
},
{
fields: {
"标题": "ClawHub Skill搜索CLI教程",
"状态": "写作中",
"关键词": ["OpenClaw", "Agent Skills"],
"浏览量": 0,
"已完成": false
}
},
{
fields: {
"标题": "MCP服务器安全审计指南",
"状态": "已发布",
"关键词": ["MCP", "Agent Skills"],
"浏览量": 1520,
"已完成": true
}
}
]
})
feishu_bitable_app_table_record({
action: "list",
app_token: "你的app_token",
table_id: "你的table_id",
page_size: 100
})
// 筛选"已发布"且浏览量>1000的记录
feishu_bitable_app_table_record({
action: "list",
app_token: "你的app_token",
table_id: "你的table_id",
filter: {
conjunction: "and",
conditions: [
{ field_name: "状态", operator: "is", value: ["已发布"] },
{ field_name: "浏览量", operator: "isGreater", value: ["1000"] }
]
}
})
// 按浏览量降序排列
feishu_bitable_app_table_record({
action: "list",
app_token: "你的app_token",
table_id: "你的table_id",
sort: [{ field_name: "浏览量", desc: true }]
})
// 1. 从网站统计获取数据
// 2. 更新Bitable中的浏览量字段
feishu_bitable_app_table_record({
action: "batch_update",
app_token: "你的app_token",
table_id: "你的table_id",
records: [
{
record_id: "rec_xxx",
fields: { "浏览量": 2580 }
}
]
})
// 筛选30天前发布且浏览量低于100的记录
feishu_bitable_app_table_record({
action: "list",
filter: {
conjunction: "and",
conditions: [
{ field_name: "发布日期", operator: "isLess", value: ["2026-05-12"] },
{ field_name: "浏览量", operator: "isLess", value: ["100"] }
]
}
})
// 然后批量标记为"待优化"
// 创建看板视图
feishu_bitable_app_table_view({
action: "create",
app_token: "你的app_token",
table_id: "你的table_id",
view_name: "内容看板",
view_type: "kanban"
})
// 创建甘特图视图
feishu_bitable_app_table_view({
action: "create",
app_token: "你的app_token",
table_id: "你的table_id",
view_name: "发布时间线",
view_type: "gantt"
})
batch_create 和 batch_update 减少API调用filter 参数精确获取需要的数据