Reputation: 3
I am using xlsxwriter library to write data in excel file and it works fine, when excel file is saved in root directory.
I want to enable user to choose where to save the file, so I am using from asksaveasfile from tkinter.filedialog :
files = [('Excel Document', '.xlsx'), ('All Files', '*.*')]
workbook = asksaveasfile(filetypes=files, defaultextension=files)
The file saves in specified folder, but won't open:
I also tried .xls , again, file can't be opened.
Thank you in advance!
Upvotes: 0
Views: 297
Reputation: 136
Your code is not complete and can not be fixed if you do not include the saving part (what happens to workbook after user choose file to save?).
It seems you are writing an empty file. Check if it has 0 size or not?
Upvotes: 1