Home » excel » powerquery – Excel get data from web from dynamic table

powerquery – Excel get data from web from dynamic table

Posted by: admin May 14, 2020 Leave a comment


I am trying to pull the full list of player data from https://stats.nba.com/players/traditional/?sort=PLAYER_NAME&dir=-1&Season=2019-20&SeasonType=Regular%20Season. However, the table is dynamic (URL doesn’t change) so when I set up the connection Excel only scrapes the first 50 rows. It does not recognize that there are 6 other pages within the table that I need to scrape as well.

Does anyone know how to use the “Get Data” -> “From Web” capability in excel to import data from a dynamic table like the one shown above?

How to&Answers:

Instead of referencing the hosting page, why not use this endpoint that is returning the JSON data that populates the table? You just need to marry up the resultsSets.headers to the array positions within rowSet entries.

Edit: I found resources that explain the NBA REST API here: http://nbasense.com/nba-api/Stats/Stats/Players/AllPlayers . Take some time and review what’s available. Any of those end-points can be consumed by Excel the way you are trying to.



Sample of a Rowset showing Aaron Gordon. Per resultSets, 2nd field is Name, 5th is age… matches the table, and gives all players not just page 1.

"rowSet": [ [ 203932, "Aaron Gordon", 1610612753, "ORL", 24.0, 1, 1, ...

For brevity, that’s just a sample and far from all of the info it returns. You can click that link and see the JSON data it’s returning within your browser.