Google-sheets – Trying to fetch data from www.csgoempire.com with ImportXML function

google sheetsimportxml

I am trying to fetch data from this link using Google Sheets' ImportXML function.

This is a betting site, and the link displays a list of roulette roll IDs on 26 June 2020. I am trying to fetch that data in the following sample format:

  1. #5317018 – 3
  2. #5317019 – 12
  3. #5317020 – 14
  4. …..

I used the following command, with no result:

=importxml("https://csgoempire.com/history?seed=1997","/html/body/div[1]/div[1]/div[3]/div/div/div[1]/div/div")

Can you help me, please?

Best Answer

From a comment to the question

That site seems to be using some sort of client-side rendering, meaning that the html page doesn't contain the info you want. Adding the content to the page is done with Javascript, so that's why what you tried isn't working. – Bas van der Linden Jun 28 at 18:09

@BasvanderLinden is right; the site itself doesn't contain any information about the rolls. If you inspect the site with the developer tools of your browser, you can find out that the rolls themselves are fetched by a call to this URL: https://csgoempire.com/api/v2/metadata/roulette/history?seed=1997. Those are in JSON, not XML, so you have to do a bit more work in order to import them in your sheet. See the question How to import JSON data into Google Spreadsheets?