shahin
Active Member
My script can parse the data from a link containing json response. The problem I'm facing is that the data available there are comma delimited. For example, I wanted to collect them like:
The way I'm having (the data are there in comma delimited):
Link to the content: "http://stats.nba.com/stats/playerda...e=Playoffs&TeamID=0&VsConference=&VsDivision="
This is my script so far:
How can I get the data (meant to spread across) in different columns instead of within a single cell?
Code:
col1 col2 col3 col4
A B C D ''Four different cells
The way I'm having (the data are there in comma delimited):
Code:
col1
A,B,C,D ''In a single cell, as in A1
Link to the content: "http://stats.nba.com/stats/playerda...e=Playoffs&TeamID=0&VsConference=&VsDivision="
This is my script so far:
Code:
Sub FetchData()
Const Url As String = "http://stats.nba.com/stats/playerdashptshots?DateFrom=&DateTo=&GameSegment=&LastNGames=6&LeagueID=00&Location=&Month=0&OpponentTeamID=0&Outcome=&PerMode=PerGame&Period=0&PlayerID=2544&Season=2017-18&SeasonSegment=&SeasonType=Playoffs&TeamID=0&VsConference=&VsDivision="
Dim Http As New XMLHTTP60, SC As Object, elem As Object
Dim results As Object, post As Object, R&
Set SC = CreateObject("ScriptControl")
SC.Language = "JScript"
With Http
.Open "GET", Url, False
.send
Set results = SC.Eval("(" + .responseText + ")")
For Each post In CallByName(results, "resultSets", VbGet)
If CallByName(post, "name", VbGet) = "ClosestDefender10ftPlusShooting" Then
[A1] = CallByName(post, "headers", VbGet)
For Each elem In CallByName(post, "rowSet", VbGet)
R = R + 1: Cells(R + 1, 1) = elem
Next elem
End If
Next post
End With
End Sub
How can I get the data (meant to spread across) in different columns instead of within a single cell?
Last edited: