How to access excel file from sharepoint using Python

I have tried using urllib to access excel file from sharepoint but getting 404 Forbidden.

Can you download the Excel file manually and then access the local copy?

There are many reasons why you might be getting 404 Forbidden:

  • is the URL correct?
  • is the URL dynamically generated, and only works for a short time?
  • is Sharepoint using geolocation to block you?
  • do you need to be logged in and authenticated?
  • do you need cookies?
  • try setting the referer to some Sharepoint URL
  • or maybe the referer needs to be a specific URL
  • maybe Sharepoint doesn’t like the useragent and thinks you are a bot

(your script is a bot!)

Many websites are designed to shut out bots. Depending on what country
you are in, it might be a criminal offense to use a script (a bot) to
download the files against the wishes of the server admins, especially
if you take special actions to bypass their security (such as using a
fake useragent).

But if you are in a legal jurisdiction where this is not an issue, then
you can try changing the useragent, setting the referer, and making sure
you have cookies enabled, and see if that helps.