How to save an Xlsxwriter file in a specific path?

Where does Xlsxwriter save the created files? Is it possible to specify the path where I want to save excel files?

My XlsxWriter script was in the file / app / smth1 / smth2 / and for some reason it saved the excel file in / app /. Didn't he save it in the same file where the script was? Or I need to specify the path as follows:

workbook = xlsxwriter.Workbook(' /app/smth1/smth2/Expenses01.xlsx') 

What is the default file in which the excel file is saved?

+7
python excel xlsxwriter
source share
1 answer

The file that it itself is saved in your local directory (where you run the file), for example, I use Python 2.7.6, and when I run this:

 workbook = xlsxwriter.Workbook('demo.xlsx') 

The file is saved in the same folder as the Python file, you can also specify the full path:

 workbook = xlsxwriter.Workbook('C:/Users/Steven/Documents/demo.xlsx') 

And this will save my demo.xlsx file in my documents folder (if you are on windows) Make sure that all your paths are correct (case sensitive and none of them are damaged) and it should work, the last example that should be copied and embedded for you:

 workbook = xlsxwriter.Workbook('app/smth1/smth2/Expenses01.xlsx') 

Please note that running "/" is not required and may cause errors (at least on Windows, I cannot say for sure on Mac / Linux). Good luck Examples can be found here.

+10
source share

All Articles