python-office Skills 索引

August 4, 2026 · View on GitHub

python-office 库的所有方法封装为独立的 Skill(技能), 每个 Skill 都是一个独立的子目录,可以单独调用。

目录


使用方式

每个 Skill 都可以单独导入和调用:

# 方式 1:直接导入函数
from skills.excel import fake2excel
fake2excel(rows=10)

# 方式 2:导入子模块
from skills.excel import fake2excel as fe
fe(rows=10, columns=['name', 'phone'])

每个 Skill 目录下都有 SKILL.md 文件,详细说明该 Skill 的参数、返回值和使用示例。


Email 邮件

⚠️ 暂无可用 Skill

office/api/email.py 中所有方法(send_emailreceive_email 等)目前都已被注释, 没有可对外暴露的函数,因此暂未封装 Skill。


Excel 处理

Skill功能所在路径
fake2excel自动创建 Excel 并模拟数据office/skills/excel/fake2excel/
merge2excel多个 Excel 合并到一个文件的不同 sheet 中office/skills/excel/merge2excel/
sheet2excel同一个 Excel 的不同 sheet 拆分为不同文件office/skills/excel/sheet2excel/
merge2sheet多个 Excel 的多个 sheet 自动合并office/skills/excel/merge2sheet/
find_excel_data搜索 Excel 中指定内容office/skills/excel/find_excel_data/
split_excel_by_column按指定列拆分 Exceloffice/skills/excel/split_excel_by_column/
excel2pdfExcel 转 PDFoffice/skills/excel/excel2pdf/

调用示例:

from skills.excel import fake2excel
fake2excel(columns=['name', 'phone'], rows=100, path='./test.xlsx')

File 文件处理

Skill功能所在路径
replace4filename批量修改文件/文件夹名称office/skills/file/replace4filename/
file_name_insert_content在文件名中间插入字符office/skills/file/file_name_insert_content/
file_name_add_prefix给文件名增加前缀office/skills/file/file_name_add_prefix/
file_name_add_postfix给文件名增加后缀office/skills/file/file_name_add_postfix/
output_file_list_to_excel整理文件名到 Exceloffice/skills/file/output_file_list_to_excel/
add_line_by_type根据类型添加行office/skills/file/add_line_by_type/
search_specify_type_file搜索指定类型文件office/skills/file/search_specify_type_file/
group_by_name按名称分组整理文件office/skills/file/group_by_name/
get_files搜索指定类型文件并返回列表office/skills/file/get_files/

调用示例:

from skills.file import replace4filename
replace4filename(path='./test_dir', del_content='old', replace_content='new')

Finance 金融计算

Skill功能所在路径
t0计算做 T 的收益office/skills/finance/t0/

调用示例:

from skills.finance import t0
profit = t0(buy_price=11.99, sale_price=12.26, shares=700)
print(profit)

Image 图像处理

Skill功能所在路径
compress_image压缩图像office/skills/image/compress_image/
image2gif图像转 GIFoffice/skills/image/image2gif/
add_watermark给图片加水印office/skills/image/add_watermark/
img2Cartoon图片转卡通风格office/skills/image/img2Cartoon/
down4img下载图片office/skills/image/down4img/
txt2wordcloud生成词云office/skills/image/txt2wordcloud/
pencil4img图片转铅笔画office/skills/image/pencil4img/
decode_qrcode解析二维码office/skills/image/decode_qrcode/
del_watermark删除图片水印office/skills/image/del_watermark/

调用示例:

from skills.image import add_watermark
add_watermark(file='test.png', mark='python-office')

Markdown 处理

Skill功能所在路径
excel2markdownExcel 转 Markdownoffice/skills/markdown/excel2markdown/

OCR 识别

Skill功能所在路径
VatInvoiceOCR2Excel增值税发票 OCR 识别并导出 Exceloffice/skills/ocr/VatInvoiceOCR2Excel/

PDF 处理

Skill功能所在路径
pdf2docxPDF 转 Wordoffice/skills/pdf/pdf2docx/
pdf2imgsPDF 转图片office/skills/pdf/pdf2imgs/
txt2pdf文本文件转 PDFoffice/skills/pdf/txt2pdf/
split4pdf拆分 PDF 文件office/skills/pdf/split4pdf/
encrypt4pdf加密 PDF 文件office/skills/pdf/encrypt4pdf/
decrypt4pdf解密 PDF 文件office/skills/pdf/decrypt4pdf/
add_text_watermark添加文本水印office/skills/pdf/add_text_watermark/
merge2pdf合并多个 PDF 文件office/skills/pdf/merge2pdf/
del4pdf删除 PDF 指定页面office/skills/pdf/del4pdf/
add_img_water给 PDF 添加图片水印office/skills/pdf/add_img_water/
add_watermark给 PDF 添加水印(交互模式)office/skills/pdf/add_watermark/
add_mark给 PDF 添加水印office/skills/pdf/add_mark/
add_watermark_by_parameters参数化添加水印office/skills/pdf/add_watermark_by_parameters/

PPT 处理

Skill功能所在路径
ppt2pdfPPT 转 PDFoffice/skills/ppt/ppt2pdf/
ppt2imgPPT 转图片office/skills/ppt/ppt2img/
merge4ppt合并多个 PPT 文件office/skills/ppt/merge4ppt/

Tools 工具

Skill功能所在路径
transtools翻译工具office/skills/tools/transtools/
qrcodetools生成二维码office/skills/tools/qrcodetools/
passwordtools生成密码office/skills/tools/passwordtools/
weather获取当前天气office/skills/tools/weather/
url2ipURL 转 IP 地址office/skills/tools/url2ip/
lottery8ticket生成 8 位彩票号码office/skills/tools/lottery8ticket/
create_article自动创建文章office/skills/tools/create_article/
pwd4wifi生成 WiFi 密码列表office/skills/tools/pwd4wifi/
net_speed_test网络速度测试office/skills/tools/net_speed_test/
course显示课程信息office/skills/tools/course/

Video 视频处理

Skill功能所在路径
video2mp3视频转 MP3office/skills/video/video2mp3/
audio2txt音频提取文字office/skills/video/audio2txt/
mark2video给视频添加水印office/skills/video/mark2video/
txt2mp3文本转语音office/skills/video/txt2mp3/

WeChat 微信

Skill功能所在路径
send_message发送消息给指定联系人office/skills/wechat/send_message/
send_message_by_time定时发送消息office/skills/wechat/send_message_by_time/
chat_by_keywords关键词自动聊天office/skills/wechat/chat_by_keywords/
send_file发送文件office/skills/wechat/send_file/
group_send群发消息office/skills/wechat/group_send/
receive_message接收微信消息office/skills/wechat/receive_message/
chat_robot智能聊天office/skills/wechat/chat_robot/

Word 文档处理

Skill功能所在路径
docx2pdfWord 转 PDFoffice/skills/word/docx2pdf/
merge4docx合并多个 Docx 文件office/skills/word/merge4docx/
doc2docxDoc 转 Docxoffice/skills/word/doc2docx/
docx2docDocx 转 Docoffice/skills/word/docx2doc/
docx4imgs从 Word 提取图片office/skills/word/docx4imgs/

Ruiming 测试 API

Skill功能所在路径
screen_unmarked_image筛选未标记的图像office/skills/ruiming/screen_unmarked_image/
change_label_in_xml修改 XML 中的 labeloffice/skills/ruiming/change_label_in_xml/
screen_without_label_json_file筛选无 label JSON 的文件office/skills/ruiming/screen_without_label_json_file/

设计说明

每个 Skill 的目录结构:

office/skills/<category>/<skill_name>/
├── SKILL.md       # Skill 的详细说明文档
└── __init__.py    # 暴露 Skill 接口,让用户可以单独调用
  • 细粒度:每个方法对应一个独立 Skill
  • 可单独调用:每个 Skill 都可通过 from skills.<category> import <skill_name> 单独使用
  • 文档齐全:每个 Skill 都有对应的 SKILL.md 详细说明

统计

  • 总计:73 个 Skill,涵盖 13 个分类
  • 各分类 Skill 数量:
    • Excel:7
    • File:9
    • Finance:1
    • Image:9
    • Markdown:1
    • OCR:1
    • PDF:13
    • PPT:3
    • Tools:10
    • Video:4
    • WeChat:7
    • Word:5
    • Ruiming:3