extract data from web

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi Aswathy,
I checked out the site and you'd need to make a POST command with 1 item in the body: zipCode=V8P+2L3 (example zip code in Canada). You can find this by starting the website, click "Inspect" and go for the Network tab. Then search for a postal code and click FIND. You'll see a bunch of files loading, with some searching I found that all info is in dearlers/, for which you can check the headers and find the Form data (=POST information). For a how-to, check out e.g. Web Scraping Tutorial - Learn Web Scraping from basics
Cheers,
Koen

1583228271835.png
 
Upvote 0
thanks you dear
thats shows only 25 retailers in V8P 2L3
how can i get the whole list?
 
Last edited:
Upvote 0
i am using the below code
VBA Code:
Private Sub CommandButton1_Click()

'Sheet1.WebBrowser1.navigate (Sheet1.Range("K2"))
'Sheet1.WebBrowser1.navigate ("http://www.fueloffroad.com/dealers/")

Do
DoEvents

Loop Until Sheet1.WebBrowser1.readyState = READYSTATE_COMPLETE

'UserForm1.TextBox1.Text = Sheet1.WebBrowser1.document.body.innerText
the_html_code = Sheet1.WebBrowser1.document.body.innerText

'UserForm1.TextBox1.Text = Sheet1.WebBrowser1.document.body.innerText

start_of_href = InStr(the_html_code, "Retail Dealer")

If start_of_href > 0 Then
the_url = Mid(the_html_code, start_of_href + 15, Len(the_html_code))

MsgBox the_url

End If

'UserForm1.Show
'UserForm1.TextBox1.Text = the_url


End Sub
can help me to continue?
 
Upvote 0
Hi Aswathy,
that code doesn't work in my test case (just open a new excel file, copy-paste your code and try to run it), so I can't test it for you.
Secondly: the site probably only shows maximum 25 results per postal code search and they don't have a button for "next 25 results". So I assume that the only thing you can do is to check more postal codes if you want the total list.
Cheers,
Koen
 
Upvote 0
Thank you Rijnsent

i need a clarification that
in my text box i have different lines
eg:
textbox1

me aswathy
from trivandrum
kerala district

i need to copy these texts from textbox1 to my excel sheet in A1, A2 and A3
but when i tried the whole sentence got only in a Single cell means A1 contans all these words.
how i split in to different cells?
 
Upvote 0

Forum statistics

Threads
1,215,463
Messages
6,124,965
Members
449,201
Latest member
Jamil ahmed

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