5 openpyxl

5.1 项目简介

用于读取/写入Excel 2010 xlsx / xlsm文件的Python库

5.2 项目地址

http://bitbucket.org/openpyxl/openpyxl/src

5.3 文档地址

https://openpyxl.readthedocs.io/

5.4 最佳实践

pip3 install openpyxl
from openpyxl import Workbook
wb = Workbook()

# grab the active worksheet
ws = wb.active

# Data can be assigned directly to cells
ws['A1'] = 42

# Rows can also be appended
ws.append([1, 2, 3])

# Python types will automatically be converted
import datetime
ws['A2'] = datetime.datetime.now()

# Save the file
wb.save("sample.xlsx")


© pengpeng 本站总访问量修改时间: 2020-07-26

results matching ""

    No results matching ""