I have a code that grabs a table from this url
https://www.reuters.com/companies/AAPL.OQ/financials/income-statement-annual
The code is OK and no problem at all except one point. The code gets the table but doesn't get the header
With http
.Open "Get", sURL, False
.send
html.body.innerHTML = .responseText
End With
Set tbl = html.getElementsByTagName("Table")(0)
For Each rw In tbl.Rows
r = r + 1: c = 1
For Each cl In rw.Cells
ws.Cells(r, c).Value = cl.innerText
c = c + 1
Next cl
Next rw
When inspecting the URL, I found that API URL supported
https://www.reuters.com/companies/api/getFetchCompanyFinancials/AAPL.OQ
How can I extract the desired data "annual" for "income" from the JSON response?
I tried to refer to the section I desire but got an error
Const strUrl As String = "https://www.reuters.com/companies/api/getFetchCompanyFinancials/AAPL.OQ"
Sub Test()
Dim a, json As Object, colData As Collection, sFile As String, i As Long
With CreateObject("MSXML2.ServerXMLHTTP.6.0")
.Open "GET", strUrl
.send
Set json = JSONConverter.ParseJson(.responseText)
End With
Set colData = json("market_data")("financial_statements")
Stop
End Sub