Google Sheet Web-scraping ImportXml Xpath on Yahoo Finance

Viewed 1327

I am trying to get stock information from Yahoo Finance with webscraping ImportXml Xpath,into my Google Sheet. I can get it to work with the %change, but not with the price, there I get a number I dont reconize anywhere on the page, can anybody pleas help me. My xmlImport for my Price look like this:

=INDEKS(IMPORTXML("https://finance.yahoo.com/quote/CVNA?p=CVNA";"//*[@id='quote-header-info']/div[3]/div[1]/div/span[1]");1)

And my xmlImport for my %Change look like this

=INDEKS(IMPORTXML("https://finance.yahoo.com/quote/CVNA?p=CVNA";"//*[@id='quote-header-info']/div[3]/div[1]/div/span[2]");1)

enter image description here

1 Answers

try:

=REGEXEXTRACT(INDEX(IMPORTXML(
 "https://finance.yahoo.com/quote/CVNA?p=CVNA";
 "//*[@id='quote-header-info']");;3); "\d+.\d+|\d+")+0

enter image description here

enter image description here


update:

=SUBSTITUTE(REGEXEXTRACT(INDEX(IMPORTXML(
 "https://finance.yahoo.com/quote/CVNA?p=CVNA"; 
 "//*[@id='quote-header-info']");;3); "\d+.\d+|\d+"); "."; ",")*1
Related