- Online Excel Sheet Download
- How Do I Download An Excel Online File
- How To Download An Excel Online File Free
- How To Download An Excel Online File
- Go to this url https://www.horseracebase.com/horse-racing-results.php?year=2005&month=3&day=15 (username = TrickyBen | password = TrickyBen123)
- Notice that there is a Download Excel button (in Red)
- I want to download the excel file and turn it into a pandas dataframe. I want to do it programatically (ie. from the script, not by manually clicking around the website). How would I do this?
Go to File > Save As, and then pick OneDrive to save documents directly from programs like Word, Excel, and PowerPoint. For detailed steps, see Save documents online. In Office 2010.
This code will get you logged in as TrickyBen, and make a request to the website API...
import requests from lxml import html from requests import Session import pandas as pd import shutil
If you inspect element, you'll notice that the relevant element looks like this...
I get this error message...
2 Answers
I'm thinking that you can see the data that you want to download in another web page, for example, by clicking on 'My Systems (v4)'. If you can do that, then you can use urllib.request.urlretrieve to download that page. And then you can use html.parser.HTMLParser to parse the data and do with as you wish.
If you would look at the api being called on the form action, you'll see that you've to make a post request to this url :
with following parameters:
you can do something like this:
If this doesn't work, try adding headers to the request like: headers=postHeaders
. For ex. you should set the content type header in this case, as you're sending form encoded data, so:
Read this for more info on how to save the excel to a file
Here's the response for this request in Postman, so looks like you won't need any additional headers except the content-type
:
Online Excel Sheet Download
EDIT
How Do I Download An Excel Online File

This is what you need to do: