google-sheets

Google Sheets IMPORTHTML "Could not fetch data"


I'm trying to figure out why all of a sudden my importhtml links are not working anymore and they say "Could not fetch data from url".

Here the link to the site https://www.baseball-reference.com/players/split.fcgi?id=wheelza01&year=Career&t=p

On that site scroll down to 'Batting Order Positions' and then im trying to just pull tOPS+ data. Is there any way i can use XML? I was just using the link in the embed table for importhtml and it was working before

Any help much appreciated

Update: How would do get around the Split error? enter image description here


Solution

  • The data are masked by

    <!-- ... -->
    

    , nevertheless you can retrieve them by this way

    =importxml(A1,"//div[@class='table_wrapper setup_commented commented']")
    

    assuming in A1 you have your url. If you only need 'Batting Order Positions', then try

    =query(importxml(A1,"//div[@class='table_wrapper setup_commented commented']"),"select Col3 where Col3 contains 'Batting Order Positions' ")
    

    Then you have to split the response to get a clean table.

    enter image description here