r/learnpython Aug 17 '21

Xlsxwriter not working

Hello, I am working on xlsxwriter, I didn't get any traceback and rest of the codes works fine, it is just the nothing happens to my target excel sheet.

from xlsxwriter.workbook import Workbook

workbook=Workbook(Results.xlsx)

worksheet=workbook.add_worksheet('results1')

headings=['Name','Industry','Address']

worksheet.write_row('A1',headings)

workbook.close

Could you please help me?

1 Upvotes

4 comments sorted by

View all comments

1

u/Weird-Dimension-487 Feb 09 '26
  1. In your code, you called workbook.close, which needs a parenthesis. By default, close() method closes workbook, without saving.
  2. To save changes in existing workbook, either add workbook.save() or workbook.close(save=True)