Frage

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?

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top