I'm working on a Python (3.7) script to download an Excel (XLSX) file from within Sharepoint.
I've tried using the 'requests' module, as well as the 'Office365-REST-Python-Client' module, without success. I'm unable to open the downloaded file using Excel, the error message indicates that the file extension or the file format is invalid.
When I change the file extension to 'XLS', I see the error message '403 FORBIDDEN' within the file created by the 'requests' module. (It seems like what was actually downloaded was an error page.)
And I see the error message 'A potentially dangerous Request.Path value was detected from the client (?).' within the file created by the 'Office365-REST-Python-Client' module.
It seems the problem is that the URL for the spreadsheet I'm trying to download contains a question mark (due to there being query parameters):
...doc.aspx?sourcedoc=...&file=...&action=default
I've tried using the 'requests' module, as well as the 'Office365-REST-Python-Client' module, without success. I'm unable to open the downloaded file using Excel, the error message indicates that the file extension or the file format is invalid.
When I change the file extension to 'XLS', I see the error message '403 FORBIDDEN' within the file created by the 'requests' module. (It seems like what was actually downloaded was an error page.)
And I see the error message 'A potentially dangerous Request.Path value was detected from the client (?).' within the file created by the 'Office365-REST-Python-Client' module.
It seems the problem is that the URL for the spreadsheet I'm trying to download contains a question mark (due to there being query parameters):
...doc.aspx?sourcedoc=...&file=...&action=default