Python ExcelPython 的 Excel 开发包
顾名思义,该项目是 Python 用来处理 Excel 文档的开发包,无需 Windows 以及 Excel 环境的支持。
该项目包含五个子项目:
- openpyxl http://pypi.python.org/pypi/openpyxl
- xlsxwriter https://gitee.com/mirrors/XlsxWriter
- xlrd https://gitee.com/mirrors/xlrd
- xlwt https://gitee.com/mirrors/xlwt
- xlutils https://gitee.com/mirrors/xlutils
示例代码:
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")
评论