Scrape JSON data from multiple urls using Multi-Threading

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5.00 out of 5)
Loading...
Go back to All Questions Login or Register
125 views
0

i am pulling data using QueryTables method.. but its very slow.. how to replace it with multithreading method in Excel VBA ??

could you help me tweak my code:


Dim v
v = Array(Sheet3.Cells(1, 1), Sheet3.Cells(2, 1), Sheet3.Cells(3, 1), Sheet3.Cells(4, 1), Sheet3.Cells(5, 1))

For i = 0 To 4
With MyBook.Sheets("Sheet1").QueryTables.Add(Connection:="URL;" & v(i), Destination:=MyBook.Sheets("Sheet1").Cells(2, (i + 1))
Sheet1.Refresh BackgroundQuery:=False
End With
Next i

0

Hi Bhushan Shah,

you can’t do this via the VBA Multithreading Tool as this exploits QueryTables not VBA Procedures. I would encourage you to convert the Query to an entire VBA procedure first. You can find couple examples in my VBA Web Scraping Kit.

Then I would encourage the use of the free VBA Multithreading Tool to run the JSON queries in parallel

Simply the best place to learn VBA!

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match