In this article, I shall show you how to pull / extract or get data from a website into Excel automatically. This is one of the most used Excel features for those who use Excel for their data analysis job. If you are working for a financial analyst company, you might need to get or import daily stock prices from a website to your Excel workbook for analysis.
So, let’s learn the technique…
Extracting data (data collection and update) automatically from a web page to your Excel worksheet might be important for some jobs. Excel gives you the opportunity to collect data from a web page.
Yes, Excel is awesome like that!!
Let’s dive into the process of helping you out.
But first, a word of caution: the web page must have data in collectible formats like Table or Pre-data format. Otherwise, it would be another battle to convert it to a readable or excel-able format. You see text to columns feature isn’t always your best friend.
So, we shall assume your life is easy like that and you have a website that has data in a compatible excel-able format.
Extract Data from Google Finance Page to Excel Automatically
We will be using Excel’s From Web Command in the Data ribbon to collect data from the web. Say, I want to collect data from this page.
It is Google’s finance-related web page.
In the Excel worksheet, open the Data ribbon and click on the From Web command.
New Web Query dialog box appears.
In the address bar, I paste the address of Google’s finance web page: https://www.google.com/finance. Then I click on the Go button, placed right after the address bar.
The same web page comes in the query dialog box. Now spot the yellow arrows near the query box.
Move your mouse pointer over the yellow arrows. You see a zone is highlighted with a blue border and the yellow arrow becomes green.
I have chosen World Markets data, Currency Data, and Sector Summary.Now I click on the Import button. Import Data dialog box appears. It asks me about the location. Currently, I am planning to save it in cell A1, you can save it anywhere and everywhere.
You might see a cryptic message or two when you hit OK. Relax those aren’t aliens trying to contact you, just your worksheet is populating data.
You see the data is inserted into the worksheet.
Now let me show you where Excel did the flip. I scroll down and find this column blank.
When I checked the website I found that there was a chart there which Excel was not able to pull. So, you have to be careful about what you are taking from a web page.
Now, you have got the data and can begin working and manipulating it.
The most important/interesting thing to note here is: you don’t have to pull the updated data from time to time.
How to Refresh Excel Data for Any Update
You can manually or automatically refresh the data. How? Say Abracadabra! No, am just kidding. (But it’s almost like magic).
Click on the drop-down part of the Refresh All command.
You can click on Refresh if you think you have only one data and you can click on Refresh All if you think you have more than one data to be refreshed.
You can even set a time period for refreshing data automatically. Click on this Connection Properties option from the list.
Connection Properties dialog box appears.
You can name the connection. Add a description to it.
Under Refresh Control, you get a command Refresh Every (by default 60 minutes), you can change it.
Or you can choose the option Refresh Data when opening the file. I click OK. So, the data of this worksheet will be updated when I will open the worksheet.
So, this is how you can pull data from a web page, manipulate the data in your own way, and then you can set when the data will be updated automatically.
Cool, right? Now time for a coffee!!
Very Good!
is the data in the web page is not highlighted with the yellow arrow, how do I download the data??
thank you! just one question, what if we want to keep record of these data for a year?
You have to use VBA or you can use Power Query.
how to use chrome instead of ie to fetch data in web query
We shall cover this topic soon.
Thanks.
This works for windows Excel but not mac Excel. How do you do for mac Excel 2016
following for answer
Hi, I’ve exact opposite condition. How can I do? Excel to website using PHP.
Very useful, I had this question in mind but never had the patience to search ( never wanted to either, necessity is the mother of all invention),now, when i searched I hit the jackpot in the first link that popped up in google search. What I searched for “how to show values from a website in a excel”. Thanks EXCELDEMY.com!!
Hi Vishnu,
Thanks for your nice words.
Best regards
Thanks for finally writing about > How to Pull/Extract Data from a Website into Excel Automatically?
< Loved it!
Hi Kawser,
I accessed the Google finance site in terms of your first screen print, however I cannot see any yellow squares with a red arrow to select any section of the page. Do have to turn on something to see these, I am using Excel 2019 Professional Plus version, on Windows 10 Professional 64 bit. I checked another web site, and also cannot see the yellow square. What do I have to turn on in Excel to be able see these ?
Hi Kawser,
What would be the best way to do the opposite – that is pull data from an excel worksheet into a website?
Thanks
Hi, you mentioned how to export web data when the data is already in table-format. How would I do this when the data is not in table-format. Thank you!
Hi Kawser, Excel 365 Enterprise is not extracting table from Sharepoint site. My company provides Edge, Chrome or IE browser. Excel message is “You may be trying to access this site from a secured browser on the server. Please enable scripts and reload this page.” in spite Edge JavaScript is enabled. ① Does browser type matter? ② what can be done to Secured Browser ? ③ any alternative other than VBA or Add-In. Thanks Ahead!
How can I pull just the emails into an excel sheet without the name, address, phone etc. if they are not set up in a list. Does a program like that exist? I don’t want to have to copy and past each one! Thank you!