繁体   English   中英

使用python创建excel文件

[英]Creation of excel file using python

有没有办法使用pywin32创建excel对象,即使在基于Windows的系统上没有安装MS-OFFICE套件?

这将做你想要的。

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("C:\\Users\\your_path_here\\Desktop\\sample.xlsx")

请参阅此链接了解详情。

https://pypi.python.org/pypi/openpyxl

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM