IMPORTXML and right XPath from Bloomberg price [duplicate]

if all you are getting is #N/A error you have 3 options before turning to a script

  1. disable JavaScript. google sheets’ IMPORT formulae do not support the reading of JS content/elements. after you disable JS on your URL and the element you wish to scrape is not present there is 99.9% certainty you can give up! if the stuff you seek is still there move to point 2…

    enter image description here

  2. run an XML debugging formula to test what can be scrapped:

    =IMPORTXML("URL"; "//*")
    

    if the result is #N/A give up and move to point 3…

  3. run a sourcecode debugging formula to test what else can be scrapped:

    =IMPORTDATA("URL")
    

    if the output is #N/A give up and move to the next point. if the output is any other kind of error try:

    =QUERY(FLATTEN(IMPORTDATA("URL")); "where Col1 is not null"; )
    
  4. at this stage open a google and try to find a different website that hosts the same data you want to get. then repeat steps 1-3. still no luck and your requirements are not that high? move to the next point…

  5. go to google and search the URL. if there is a match try to check if there is a Cache:

    enter image description here

    take the URL and repeat steps 2-3. if this is not your thing or if luck left your life for good, move to point 6…

    =IMPORTXML("https://webcache.googleusercontent.com/search?q=cache:aQET6JV0DywJ:https://www.bloomberg.com/quote/KAUGVAA:LX&cd=1&hl=en&ct=clnk", 
     "//div[@class="overviewRow__66339412a5"]")
    

    enter image description here

  6. give up or use a script

Leave a Comment

tech