XlsxWriter module
- Install
XlsxWriter
module from the command line:
pip install XlsxWriter
- Write data to MS Excel (XLSX) file:
import xlsxwriter
data = [
['John', 25],
['Mary', 30],
['Robert', 42],
]
workbook = xlsxwriter.Workbook('test.xlsx')
worksheet = workbook.add_worksheet()
row = 0
for item in data:
worksheet.write(row, 0, item[0])
worksheet.write(row, 1, item[1])
row += 1
workbook.close()
Leave a Comment
Cancel reply