shahin
Active Member
Perhaps this question has been asked before in different threads within different forums. It is sometimes hard to find any exact match of any search. So, apology in advance if it is identical to any thread.
I've created a script in vba to parse tabular data from a webpage. My script can do it's job flawlessly. The thing is: I'm only after certain columns. So I wish to scrape 4 columns out of 8.
The eight column headers look exactly like:
I wish to get the content under:
This is the script which can get all the content under 8 columns from that table (once provided by sir chihiro):
I've created a script in vba to parse tabular data from a webpage. My script can do it's job flawlessly. The thing is: I'm only after certain columns. So I wish to scrape 4 columns out of 8.
The eight column headers look exactly like:
Code:
Player From To Pos Ht Wt Birth_Date College
I wish to get the content under:
Code:
To Pos Ht Wt
This is the script which can get all the content under 8 columns from that table (once provided by sir chihiro):
Code:
Sub TableData()
Dim HTTP As New ServerXMLHTTP60, html As New HTMLDocument
Dim posts As Object, elem As Object, trow As Object
With HTTP
.Open "GET", "http://www.basketball-reference.com/players/a/", False
.send
html.body.innerHTML = .responseText
End With
Set posts = html.getElementsByTagName("table")(0)
For Each elem In posts.Rows
For Each trow In elem.Cells
c = c + 1: Cells(r + 1, c) = trow.innerText
Next trow
c = 0
r = r + 1
Next elem
End Sub