jonathanwang003
Board Regular
- Joined
- May 9, 2014
- Messages
- 133
I saw a snippet of a macro where data from a website was scraped into a spreadsheet. I wasn't sure how it worked so I I added a sample URL and the section of code that could somewhat understand. How would we print the data to a spreadsheet?
VBA Code:
Public HttpRequest As WinHttp.WinHttpRequest
Public qURL As String
Sub Download_Table()
Set HttpRequest = New WinHttp.WinHttpRequest
'Sample URL
qURL = "https://query1.finance.yahoo.com/v7/finance/download/ANET?period1=1619755602&period2=1651291602&interval=1d&events=history&includeAdjustedClose=true"
With HttpRequest
.Open "GET", qURL, False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
.send
.waitForResponse (10)
End With
End Sub