1

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!

1 Answers1

2

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

halfer
  • 19,824
  • 17
  • 99
  • 186
Tanaike
  • 181,128
  • 11
  • 97
  • 165
  • Tanaike you are awesome! Thank you so much. This helps me learn more XML too. I had tried a number of variations but hadn't considered the "/.../p" at the end. Cheers mate! – SOtoTheRescue Apr 18 '20 at 02:21
  • @CayG Thank you for replying. I'm glad your issue was resolved. – Tanaike Apr 18 '20 at 06:26