How do I pull this website data?

srallen3

New Member
Joined
Feb 26, 2016
Messages
31
Office Version
  1. 2019
Platform
  1. Windows
so use Power Query
Power Query:
// Table 0
let
    Source = Web.Page(Web.Contents("https://www.espn.com/nba/stats/team/_/view/opponent")),
    Data0 = Source{0}[Data],
    Index = Table.AddIndexColumn(Data0, "Index", 1, 1)
in
    Index

Power Query:
// Table 1
let
    Source = Web.Page(Web.Contents("https://www.espn.com/nba/stats/team/_/view/opponent")),
    Data1 = Source{1}[Data],
    Index = Table.AddIndexColumn(Data1, "Index", 1, 1)
in
    Index

Power Query:
// Merge1
let
    Source = Table.NestedJoin(#"Table 0",{"Index"},#"Table 1",{"Index"},"Table 1",JoinKind.LeftOuter),
    Expand = Table.ExpandTableColumn(Source, "Table 1", {"GP", "PTS", "FGM", "FGA", "FG%", "3PM", "3PA", "3P%", "FTM", "FTA", "FT%", "OR", "DR", "REB", "AST", "STL", "BLK", "TO", "PF"}, {"GP", "PTS", "FGM", "FGA", "FG%", "3PM", "3PA", "3P%", "FTM", "FTA", "FT%", "OR", "DR", "REB", "AST", "STL", "BLK", "TO", "PF"}),
    RC = Table.RemoveColumns(Expand,{"Index"}),
    Type = Table.TransformColumnTypes(RC,{{"RK", Int64.Type}, {"Team", type text}, {"GP", Int64.Type}, {"PTS", type number}, {"FGM", type number}, {"FGA", type number}, {"FG%", type number}, {"3PM", type number}, {"3PA", type number}, {"3P%", type number}, {"FTM", type number}, {"FTA", type number}, {"FT%", type number}, {"OR", type number}, {"DR", type number}, {"REB", type number}, {"AST", type number}, {"STL", type number}, {"BLK", type number}, {"TO", type number}, {"PF", type number}})
in
    Type
just in case

Got it, thank you!
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

srallen3

New Member
Joined
Feb 26, 2016
Messages
31
Office Version
  1. 2019
Platform
  1. Windows
You are welcome & have a nice day
I have another question if you don't mind, if so just let me know and I will post another thread.

I decided to also add an entire excel database tab of every current NBA player that has a column for their respective team, and then columns for stats. Is there a formula I can input that will search that database tab for a specific team, and then return the player name beside that team to that cell, and then do the same thing for the cell under it but the next players name, and so on and so forth until every player that plays for that team has had their name returned?
 

sandy666

Banned - Rules violations
Joined
Oct 24, 2015
Messages
7,499
This is different question so post new thread
(with representative data source and expected result and detailed description)
 

Watch MrExcel Video

Forum statistics

Threads
1,127,513
Messages
5,625,240
Members
416,084
Latest member
justinjambox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top