Reputation: 3
I'm looking for data on the Yahoo Finance website for EV / EBITDA, but xPath returns values where I can't get the ID:
https://finance.yahoo.com/quote/CARD3.SA/key-statistics?p=CARD3.SA
xPath:
// * [@ id = "Col1-0-KeyStatistics-Proxy"] / section / div [3] / div [1] / div [2] / div / div [1] / div [1] / table / tbody / tr [9] / td [4]
There are no differences between xpath "current" and 03/31/2020 except in full xpath (one is 4 and the other 3):
current:
/ html / body / div [1] / div / div / div [1] / div / div [3] / div [1] / div / div [1] / section / div [3] / div [1 ] / div [2] / div / div [1] / div [1] / table / tbody / tr [9] / td [4]
03/31/2020:
/ html / body / div [1] / div / div / div [1] / div / div [3] / div [1] / div / div [1] / section / div [3] / div [1] / div [2] / div / div [1] / div [1] / table / tbody / tr [9] / td [3]
cheers!
Upvotes: 0
Views: 174
Reputation: 5915
IMPORTXML
nor IMPORTHTML
can't import the data. You should use IMPORTFROMWEB addon to do this (note : number of requests are limited with the "Free" plan) :
You'll need the following XPath :
For headers :
//span[.="Current"]/ancestor::tr[1]//span[text()][count(./*)=0]
For data :
//span[.="Enterprise Value/EBITDA"]/../following-sibling::td
Output :
Formula used in C4 :
=TRANSPOSE(IMPORTFROMWEB(C1;C2:D2))
Possible alternative : GoogleAppScript to request and load the JSON data directly from the Yahoo API.
Upvotes: 1