0

I've used ImportHTML plenty of times before and never really had any issues with it, but for some reason, I can't seem to pull a particular table from Basketball-Reference, even though I've pulled other tables from there just fine. The table I want is the Miscellaneous Stats table lower down on this page. I've tried every index from 1 to 30 in the function, but none of them past 7 bring in any data. The function I'm using is below, with the 1 changing to whatever index I'm trying:

=IMPORTHTML("https://www.basketball-reference.com/leagues/NBA_2019.html", "table", 1)

I tried using the following code in Chrome's console to find the index of the page, but it didn't return anything:

var i = 1; [].forEach.call(document.getElementsByTagName("table"), function(x) { console.log(i++, x); });

Does anyone know how I can get this table working with ImportHTML?

Rubén
  • 34,714
  • 9
  • 70
  • 166
Ryan G
  • 63
  • 1
  • 8

1 Answers1

1

Well, player0 was correct about being unable to scrape the JS table, but luckily I was able to use the URL for the embed version of that table, which works perfectly with ImportHTML.

Ryan G
  • 63
  • 1
  • 8
  • The URL no longer returns a table, instead is shows "Sports Reference has turned off our widgets service effective January 1, 2023" – Rubén Jan 09 '23 at 17:44