Reputation: 197
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)
Upvotes: 2
Views: 2595
Reputation: 1
try:
=REGEXEXTRACT(INDEX(IMPORTXML(
"https://finance.yahoo.com/quote/CVNA?p=CVNA";
"//*[@id='quote-header-info']");;3); "\d+.\d+|\d+")+0
=SUBSTITUTE(REGEXEXTRACT(INDEX(IMPORTXML(
"https://finance.yahoo.com/quote/CVNA?p=CVNA";
"//*[@id='quote-header-info']");;3); "\d+.\d+|\d+"); "."; ",")*1
Upvotes: 0