Automatically extract website data to a spreadsheet

Corried

Board Regular
Joined
Dec 19, 2019
Messages
217
Office Version
  1. 2019
Platform
  1. Windows
  2. Web
Hello, Thank you for sharing..

I am looking for courses on how to automatically extract data from a website to an excel spreadsheet.

The excel file contains fifty links. Each link has the same process, to create a stock market report for fifty companies. Use macro and chrome to generate data.

Can anyone show me a step by step process on how I can do this?

Please watch the video and Excel workbook below to learn more.



I hope you all understand.

Cheers
 
  1. The thread below has some explanations at post #4
  2. It worked for me with Edge, please try it. Note that probably a driver update is necessary.


selbas.png


VBA Code:
Public driver As New EdgeDriver
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
  1. The thread below has some explanations at post #4
  2. It worked for me with Edge, please try it. Note that probably a driver update is necessary.


View attachment 61809

VBA Code:
Public driver As New EdgeDriver
Good day Worf

It took me sometime to figure out how to install Edge Driver.

Below are links to walk members through this step-by-step process:

How to Automate Edge Browser using Excel Macros

SeleniumBasic v2.0.9.0 Installation

Microsoft Edge WebDriver Version
 
Upvote 0
  1. The thread below has some explanations at post #4
  2. It worked for me with Edge, please try it. Note that probably a driver update is necessary.


View attachment 61809

VBA Code:
Public driver As New EdgeDriver
I am sorry, Wolf. I did not want to disturb you.

I have not found the solution to fix this problem

Both Edge & Chrome give the same error.

Searched online for hours. Nothing.?
 
Upvote 0
Can you try it using another computer?
Thanks Wolf for your recommendation. I am not sure. Can you send me your file copy?

I've used my wife laptop. I'm not sure why I am getting the same error:

[b2] = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 > div > div > div:nth-child(1) >" & _
" div > div.firstSection-DS-EntryPoint1-1 > div.quoteInfo-DS-EntryPoint1-1 > div.title-DS-EntryPoint1-1 > span.displayName-DS-EntryPoint1-1").Text
 

Attachments

  • Screenshot 2022-04-13 231620.png
    Screenshot 2022-04-13 231620.png
    8.2 KB · Views: 6
Upvote 0
Also, try this code that uses a different page just to see what happens:

VBA Code:
Sub HongKongFoo()
Dim driver As New ChromeDriver, pt
driver.get "https://racing.hkjc.com/racing/information/english/Racing/JockeysRides.aspx"
Application.Wait Now + TimeValue("0:00:06")
Set pt = driver.FindElementByXPath("/html/body/div[1]/div[3]/div/table")
MsgBox pt.FindElementsByTag("tr").Count, 64, "Number of table rows"
End Sub
 
Upvote 0
Also, try this code that uses a different page just to see what happens:

VBA Code:
Sub HongKongFoo()
Dim driver As New ChromeDriver, pt
driver.get "https://racing.hkjc.com/racing/information/english/Racing/JockeysRides.aspx"
Application.Wait Now + TimeValue("0:00:06")
Set pt = driver.FindElementByXPath("/html/body/div[1]/div[3]/div/table")
MsgBox pt.FindElementsByTag("tr").Count, 64, "Number of table rows"
End Sub
Wow... Can a plugin prevents these problems.
Below is my error...

I am not sure how to move forward from here...
 
Upvote 0
Guess what? My home computer stopped working again.

I ordered a new one today, but it will take weeks to arrive, Dell Brazil is rather slow.

Here at work I cannot install Selenium, but I will think of some suggestion for you.
 
Upvote 0
Concerning the Hong Kong site, the jockey table was not available when you tested, try it at a moment when it is there.

My idea using another page is to determine if the MSN site has some scraping blocking mechanism or something, because I was also getting errors sometimes.
 
Upvote 0

Forum statistics

Threads
1,223,631
Messages
6,173,465
Members
452,516
Latest member
archcalx

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