Solution 1 :

The problem with using Chrome inspect tool and then the xPath is that Chrome will show parsed HTML which might not be the same that the one that IMPORTXML can see.

IMPORTXML only is able to see the source code but Chrome shows the HTML that could be modified by JavaScript, by the other hand, if the HTML is not well formed Chrome could add some missing tags.

To know if IMPORTXML could see the content that you want to import, you could disable JavaScript in Chrome. For further details see How to know if Google Sheets IMPORTDATA, IMPORTFEED, IMPORTHTML or IMPORTXML functions are able to get data from a resource hosted on a website?

Solution 2 :

Usually, to retrieve the informations, you have to decode the json contained in the code source, i.e. script id=”boerse-frankfurt-state”, but here this script only contains the format and data are loaded by asynchonous method (ajax).

Problem :

I’m trying to retrieve an information from this page , and 532 more pages like this. The info is the SYMBOL – in this case BBUS – and for doing this in batch in a google sheet, I’ve tried the IMPORTXML. Being a total newbie, after having read the documentation on the command, and having searched for examples of queries elsewhere-the best I could come up with was:

  • in the webpage, select the text I wanted to retrieve
  • using the “inspect” command in chrome, visualize the corresponding portion of code that reads

/html/body/app-root/app-wrapper/div/div[2]/app-etp/div[1]/div/app-widget-datasheet-header/div/div/div/div/div[2]/div/span[1]

obviously, nowhere close to the simple structure I found in the query examples I was able to browse

  • click on the […] select Copy>Xpath or Copy>full Xpath”
  • paste it on my spreadsheet as =IMPORTXML(A2; "/html/body/app-root/app-wrapper/div/div[2]/app-etp/div[1]/div/app-widget-datasheet-header/div/div/div/div/div[2]/div/span[1]") being A2 the cell that contains the webpage url.

What I get is #N/A. I am prepared to the idea that it’s a matter of the way the html code is written, but being this my first time on stack overflow, I’m also prepared to get some massive help!

By