I want to import the data from options tab in yahoo finance to my google sheet. It is this tables:
Picture with the table I want to import
First of all, you can see a box with different dates that when you change the date the URL change. The difference between the URLS is that you need to sum to the previous number 604800 and then you get the correct URL.
Well if you use Excel, you can download the data (is in the table 3 the ones I want) without any issue, but you need to be changing the website manually every time that the date change.
So I was thinking to use the ImportXML or ImportHTML of google sheet. For example if you use in the main page: https://finance.yahoo.com/quote/VZ?p=VZ
This formula: =importXML("https://finance.yahoo.com/quote/VZ?p=VZ";"//*[@id='quote-header-info']/div[3]/div[1]/div/span[1]")
You will get the value of the stock in that moment but if you change the website url for the one of the options: =importXML("https://finance.yahoo.com/quote/VZ/options?date=1618531200&p=VZ";"//*[@id='quote-header-info']/div[3]/div[1]/div/span[1]")
You got a NA value... even if the value is there and the HTML code of the website is the same... and this for me does no make sense.
So I do not know how I should do to can download the data from the tab "options", and is frustrating cause it must be possible as it is really "simple" to get it in Excel.
Some suggestion?