How to save Xlsxwriter file in certain path?

[亡魂溺海] 提交于 2019-11-28 11:11:18

The file it's self is saved to your local directory (where you run the file from) for example, I am using Python 2.7.6, and when I run this:

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

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

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

And this will save my demo.xlsx file in my documents folder (assuming you are on windows) Make sure all of your paths are correct (case sensitive, and none corrupted) and it should work, the final example that should be a copy and paste for you is:

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

Notice the starting "/" is not needed and may be causing your errors (at least on Windows, I can't say for sure on Mac/Linux). Best of luck! Examples can be found here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!