Search code examples
google-sheetsyahoo-financeyahoo-api

How to extract data of previous week based on drop down from the Yahoo Fantasy Football


Hy, I am using Yahoo Fantasy Football and I have design Google Sheet to get the score data which is the working fine. The link to the sheet is as under.

Google Sheet Link

I have changed the permission to Editor. I have made a drop-down which holds the information of Week numbers. Basically, my idea is that by choosing the week number I want to populate the data from yahoo fantasy football. For importing data, i am using this command.

=importhtml("https://football.fantasysports.yahoo.com/f1/683375","table",1)

and this command is working well. I tried it by using the same command but it does not works for the week numbers. The source of the page is as under.

enter image description here

so according to the given picture, here is the week number, I want to implement the same in the google sheet by using the dropdown. I have implemented the drop down but it does not work. Is there a way to interlink both using scripts or command so from google sheet when I chose week from the drop-down the concerning data should be populated? please take a look at the Google Sheet given above. I am also getting this error, while it was working fine before, how can it be resolved also.

enter image description here

Thanks


Solution

  • IMPORTHTML cannot retrieve elements dynamically inserted by a script. In your case the content on Week matchups is inserted dynamically and therefore will not be retrieved (it will return empty). Moreover, IMPORTHTML olny gets data from tables or lists and if you inspect what it seemed to be a table in Week Matchup is just actually a series of divs. If the content would not be inserted dynamically, to get the data from these divs you would need to use IMPORTXML.

    If you still want to retrieve this information I am afraid that you will need to look for other web scraping techniques.