一个轻量、高效、即拿即用的 WPS 智能表格自动化 SDK。
【由于昨天刚赶工出来的,有少部分BUG还未完全修复。后续看时间维护并推送,但经短暂的一系列测试暂不影响使用】 支持 Python 和 JavaScript(AirScript),无需复杂配置即可实现批量数据处理、格式控制、单元格读写、排序筛选等能力。
🌐 使用文档:👉 https://www.kdocs.cn/l/cftIrDJVIvCU
•✔️ 单元格读写、批量写入
•✔️ 格式设置(字体、颜色、边框、对齐)
•✔️ 行列增删与尺寸调
•✔️ 查找、替换
•✔️ 工作表管理
•✔️ 批量数据处理性能优化
•✔️ Python & JavaScript 双端可用
pip install requestsfrom python.wps_airscript_client import WPSAirScriptClient
client = WPSAirScriptClient(
file_id="your_file_id",
token="your_token",
script_id="your_script_id",
)# 写入
client.set_cell_value("A1", "Hello WPS")
# 批量写入
client.batch_write([
["姓名","年龄"],
["张三",25],
["李四",30]
], "A1")
# 读取
print(client.get_cell_value("A1"))
AirScript 文件:javascript/wps-airsheet-api.js 可直接在 WPS 表格脚本中使用。
示例:
const api = new AirSheetAPI(token, fileId, scriptId);
api.setCellValue("A1", "Hello JS");
•script_id:来自 WPS webhook URL
•token:在 WPS 表格中创建 AirScript Token
•file_id:表格 URL 中可获取
📦 wps-airsheet-python
├── assets/ # 图片资源
├── python/ # Python客户端封装
├── javascript/ # 插入wps脚本
└── README.md
•所有 Excel 索引从 1 开始
•颜色使用 rgb_to_excel_color()
•批量写入优先使用 set_range_values / batch_write
•未指定 sheet_name 默认操作当前工作表
try:
client.set_cell_value("A1", "Test")
except Exception as e:
print("操作失败:", e)
•官方文档:https://airsheet.wps.cn/docs/api/excel/workbook/overview.html
•联系邮箱:1030695584@qq.com
•有部分demo里未有的接口,小伙伴们可自行编译。
🎉 欢迎 Fork & Star!助你轻松实现 WPS 表格自动化。