1

Creating a ticker scanner tool on googlesheets with mainly google finance and yahoo finance. No difficulties with index(importhtml()) and other functions however I can't manage to find the correct Xpath when using importxml. I have no background in html or Xpath so I am a novice but I understand the basics behind it from troubleshooting recently.

URL: https://au.finance.yahoo.com/quote/FMG.AX?p=FMG.AX

I am trying to pull in text information about SECTOR, INDUSTRY and the DESCRIPTION which is on the right hand side (about half way down the page). It seems to be within a column which may be causing me trouble. Using Chrome inspect to retrieve XML but also tried several chrome extensions which didn't work either.

This is what I got when copying Xpath (short and long versions)

Sectors:

//*[@id="Col2-11-QuoteModule-Proxy"]/div/div/div/div/p[2]

Business Summary:

/html/body/div[1]/div/div/div[1]/div/div[3]/div[2]/div/div/div/div/div/div[12]/div/div/div/div/div/p

Also tried shortening the /div with //p but doesn't work anyway.

I played around and used //body/div//div/p which retrieved news data from the middle of the page.

Wondering if someone could help me adjust or explain what I am doing wrong and point me in the right direct.

Rubén
  • 34,714
  • 9
  • 70
  • 166
Maikelele
  • 15
  • 1
  • 4

2 Answers2

0

this will never work with IMPORTXML / IMPORHTML formulae because elements you are trying to import are controlled by JavaScript which google sheets can't process.

enter image description here

player0
  • 124,011
  • 12
  • 67
  • 124
  • Thank you very much for responding. I do have IMPORTHTML formulae currently working so does that mean only certain sections are controlled by JavaScript? I appreciate the insight. Will look for some alternatives. Thank you. – Maikelele Feb 11 '21 at 21:34
  • yes, sometimes its whole page other times its just a few elements (like in your case) – player0 Feb 11 '21 at 21:40
0

Apparently, the data you are trying to pull is controlled by JavaScript which means you won't be able to fetch it using IMPORTXML.

Jason E.
  • 1,201
  • 1
  • 3
  • 10