Data Extraction from Website

dbrown14

New Member
Joined
May 24, 2011
Messages
13
I need help trying to retrieve the source code from a website.

How I normally navigate there:

I start at http://www.bls.gov/home.htm, scroll over Subject Areas, click Consumer Price Index, click Top Picks button for All Urban Consumers database (probably have to scroll down a little), check off Midwest Region All Items, 1982-1984=100 - CUUR0200SA0, click Retrieve Data, click More Formatting Options, check 3 Month Percent Change, then finally click Retrieve Data.


I'm pretty sure there are ways of getting the source code of this webpage using the xmlhttp object and the post method, but I don't know how. Any help would be greatly appreciated. I would prefer to use xmlhttp if possible, but I'm open to other methods.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I don't know how to achieve what you're asking but with the iMacro add-on in your browser you can record the sequence of the above steps, and then reproduce them in one click.
 
Last edited:
Upvote 0
Your thread title says 'Data Extraction', but your post asks how to retrieve the source code. An XMLhttp request can retrieve the source code and then more VBA is needed to parse the response in some way to retrieve the data.

If you view the HTML source for the final data page (http://data.bls.gov/pdq/SurveyOutputServlet), you will see the form fields and values which need to be sent with the request. Your VBA code will need to construct this string and send it in a POST request. Something like this:

Code:
XMLhttp.Open "POST", "http://data.bls.gov/pdq/SurveyOutputServlet", False
XMLhttp.send formData
'Response is in XMLhttp.responseText
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,551
Members
452,927
Latest member
rows and columns

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top