Search code examples
google-sheetsyahoo-financegoogle-sheets-formula

Google Sheets yahoo finance importXML text not td data


On SO I often see people inquiring about how to import data from the tables on yahoo finance. I'm trying to import the business description under the profile section from yahoo finance. It seems this would require the importxml function but I'm struggling. This is my function:

=IMPORTXML("http://finance.yahoo.com/quote/AAPL/profile", "//div[@data-reactid='139']")

I think my issue is related to "div" but not sure. Might anyone be able to provide guidance? Thanks!


Solution

  • Sample formula:

    =IMPORTXML(A1,"//h2[@data-reactid='139']/../p")
    
    • In this case, the URL of http://finance.yahoo.com/quote/AAPL/profile is put in "A1".
    • I used //h2[@data-reactid='139']/../p as the xpath.

    Result:

    enter image description here