OpenPyXL 最小 XLSX 写入示例
这是一个如何使用 OpenPyXL 写入 XLSX 文件的最小示例:
write_xlsx.py
from openpyxl import Workbook
wb = Workbook()
sheet = wb["Sheet"] # 此工作表默认创建
# 向工作表添加内容
sheet["A1"] = "This is cell A1"
# 保存
wb.save("openpyxl-test.xlsx")
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow