I'm trying to inport University rankings from QS Rank into google sheets but I just get a error messeage saying inproted content is empty.
I tried importing with the full xpath and thats when I got the error meassage. I think it might be somthing to do with javascript but I am not realy sure about that.
As the full XPath
/html/body/div[1]/div/div/div[1]/div[2]/main/section/div/section/section/div/div/article/div/div/div[3]/div/div[1]/div/section/div[2]/div[2]/div[6]/div[2]/div/div/div/div[1]/div[1]result was empty, we can debug it sequencially starting from/html/bodystep by step.Having
/html/body/div[1]/div/div/div[1]/div[2]/main/section/div/section/section/div/div/article/div/div/div[3]/div/div[1]/div/section/div[2]/div[2]/div(not full yet), we still see non empty output in A column (here A9 contains an IMPORTXML formula):The next step is to append
/div[6]to the current XPath value. Really the result in A9:A already shows multiple div structure, wherediv[1]is in A9,div[2]is in A10 and so on. Important! There is an empty cell A14 fordiv[6]. I marked it with the red arrow. That's why we obtain an empty result for the next debug step and for the full XPath respectively.I don't know the main goal and the expected result, but you should correct XPath in use. Also we should remember that the source HTML page may change sometimes, so even the working formula might require some corrections in future.
P.S.: As for the clarified task goal, IMPORTXML formula is not efficient or even helpful for a dynamic (async loaded) data scraping. We should search for some kind of workarounds. Fortunally there is such a way for the mentioned University Ranking resource: use the direct endpoint to get JSON-formatted data.