Where does Xlsxwriter save the files you have created? Is it possibly to specify the path where I want the excel files to be saved?
My XlsxWriter script was in file /app/smth1/smth2/ and for some reason it saved the excel file to /app/. Shouldn't it have saved it in the same file where the script was? Or do I have to specify the path like this:
workbook = xlsxwriter.Workbook(' /app/smth1/smth2/Expenses01.xlsx')
What is the default file where the excel file is saved?
If you are working with large files or are particularly concerned about speed then you may find XlsxWriter a better choice than OpenPyXL. XlsxWriter is a Python module that can be used to write text, numbers, formulas and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.
Here's how you can save the file to the current directory (where your script is running from):
workbook = xlsxwriter.Workbook('demo.xlsx')
Here's how you can specify a full path:
workbook = xlsxwriter.Workbook('C:/Users/Steven/Documents/demo.xlsx')
Here's how you can specify a relative path:
workbook = xlsxwriter.Workbook('app/smth1/smth2/Expenses01.xlsx')
Note that a starting "/" is not needed and may cause errors.
More examples can be found here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With