[英]How data write in xlsx file using xlsxwriter?
I am writing in excel file using python xlsxwriter module.我正在使用 python xlsxwriter 模块写入 excel 文件。
import xlsxwriter
workbook = xlsxwriter.Workbook(r"E:\python_SQL\bedroom number\2.xlsx")
sheet = workbook.add_worksheet("raviraj")
sheet.write(0, 0, "RAVIRAJ")
code is executing but no sheet is getting added in excel nor data in a cell.代码正在执行,但没有在 excel 中添加工作表,也没有在单元格中添加数据。
I am using windows 10 os and python 3.6.我正在使用 windows 10 操作系统和 python 3.6。 What I am missing?
我错过了什么?
You need to close the workbook as well.您还需要关闭工作簿。 At the end of your code, add
在代码的末尾,添加
workbook.close()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.