Python Excel操作:Openpyxl
Openpyxl
:非常简单的Excel
操作模块 (不过不支持读xls
格式; 支持报表)
Openpyxl
支持的格式: Excel 2010 xlsx/xlsm/xltx/xltm
因为简单, 所以选她… 名字比其他几个得劲一点
安装
$ sudo pip3 install openpyxl
写文件
#!/usr/bin/python3
from openpyxl import Workbook
book = Workbook()
sheet = book.active
rows = (
(88, 46, 57),
(89, 38, 12),
(23, 59, 78),
(56, 21, 98),
(24, 18, 43),
(34, 15, 67)
)
for row in rows:
sheet.append(row)
book.save('appending.xlsx')
额, 好吧, 就是这么简单…
更多的可以看看文档
参考:
- 教程:Openpyxl tutorial
- 最流行的Python Excel的模块:Working with Excel Files in Python
- Openpyxl官网:A Python library to read/write Excel 2010 xlsx/xlsm files
blog comments powered by Disqus