Reputation: 69
I have a dataframe that I want to export to an existing Excel file that exists online on my company's sharepoint. I have the following line of code to do this:
df.to_excel(r'Path where the exported excel file will be stored\File Name.xlsx', sheet_name='Your sheet name', index = False)
The filepath starts with https and ends with a filetype .xlsx?web=1
Python of course doesn't recognise .xlsx?web=1 as a valid filetype so do I just ignore the ?web=1 at the end? This is what I did but get an access denied error. What do I need to do to be able to export to this file?
Upvotes: 0
Views: 1365
Reputation: 43495
The filepath starts with
https
and ends with a filetype.xlsx?web=1
That's not a path, that's a URL. You cannot simply "save" to a URL.
There are Python libraries for working with sharepoint. For example Office365-REST-Python-Client, pysharepoint and this one on pypi, but the latter only seems to support downloading, not uploading.
Since pysharepoint
is basically a front-end for SharePlum, you might want to look at that as well. It comes with documentation.
Upvotes: 2