Peretz Herzog
Peretz Herzog

Reputation: 1

google sheet IMPORTXML for web https://allurepack.com/

I am trying to web scrap to get the price from a website https://allurepack.com/

I tried using a google formula IMPORTXML with XPath //*[@id="ProductSection-product-template"]/div/div[2]/div/div[2]/div/span[1]/span but it's not working

Upvotes: 0

Views: 44

Answers (1)

Pedram Najafizadeh
Pedram Najafizadeh

Reputation: 23

The link you have mentioned does not have any price in it. but if we scrape one of the pages inside this website, like "https://allurepack.com/collections/holiday-jewelry-boxes", you can get the price easily with this code:

=IMPORTXML("https://allurepack.com/collections/holiday-jewelry-boxes","//*[@id='Collection']/div[2]/div[1]/form/div/div/div[1]/span")

Also make sure that you put quotations around id. when you copy XPATH of an element, it put double quotations (") around id

//*[@id="Collection"]/div[2]/div[1]/form/div/div/div[1]/span

but google function also needs a double quotation around the xpath_query so you need to replace double quotations to single quotation like this:

from:

//*[@id="Collection"]/div[2]/div[1]/form/div/div/div[1]/span

to:

//*[@id='Collection']/div[2]/div[1]/form/div/div/div[1]/span

and you will get the result.

you can see my screenshot here

Upvotes: 0

Related Questions