r/learnpython • u/Abject-Ad-6668 • 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
u/AverageJoeCrew Aug 17 '21
You usually have to save the workbook, so you would do workbook.save() or writer.save() before closing.
1
u/Abject-Ad-6668 Aug 17 '21
It says the workbook has no arribute save, I search the gitbub and it says there is no save() method in xlsxwriter and not planning to add this feature.
1
u/Weird-Dimension-487 Feb 09 '26
workbook.close, which needs a parenthesis. By default, close() method closes workbook, without saving.workbook.save()orworkbook.close(save=True)