I'm using Google Sheet IMPORTHTML() to get the text from a website. I am trying to get the text after a certain search string via IMPORTHTML() in Google Sheet using XPath.
As an example, I would like to extract number of rooms and living space from the websites below https://www.comparis.ch/immobilien/details/favorite?id=26720381
https://www.comparis.ch/immobilien/details/favorite?id=26714976
when i extract the xpath via chrome, it unfortunately isn't always exactly the same for each url. That's why I wanted to try with searching a string:
//*[@id="__next"]/div/div[1]/div[1]/div[4]/div[1]/div[3]/div[1]/div/div/div[2]/div/div[1]/p
//*[@id="__next"]/div/div[1]/div[1]/div[4]/div[1]/div[3]/div[1]/div/div/div[2]/div/div[1]/p/span
Plan is therefore to have in column A a list of urls, in row 1 the respective xpath (incl. search string like "room" or "living space" and a table where =importxml($A2,B$1) would use these urls and xpaths to search for the respective values.
I was trying to get the following-sibling after the place where it found for example the string "room" or "living space"
Help is much appreciated as I am new and lost at the moment. Best, Ueli

