-1

I am trying to import the pricing from Best Buy's website into a Google Sheet so I don't have to load each page to check the current price of an item.

I found a solution on reddit here and using =index(IMPORTXML(A2,"//span[@class='sr-only']"),1,3) to use the URL reference and look up the info works fine for most items, an example of which is here.

The issue is that this code fails on some items (like this cell phone) even though the same "sr-only" exists. The only way I've seen to get this to work is using the full xpath like below

=index(IMPORTXML(A2,"/html/body/div[3]/main/div[2]/div[3]/div/div/div[3]/div[2]/div/div/div/div/div[1]/div/div[1]/div[2]/span[2]"),1,3)

That returns the activate today price, I am not sure how to get this to return the full retail/activate later since the URLs are the same and the query can't change that option on the page.

I also tried using =index(IMPORTXML(A2,"//span[@class='activated-pricing__option-price']"),1,3) to get the full retail/activate later price of $699.99 but that fails.

jnjustice
  • 83
  • 1
  • 9
  • Does this answer your question? [Google Sheets importXML Returns Empty Value](https://stackoverflow.com/questions/61470783/google-sheets-importxml-returns-empty-value) – Rafa Guillermo Dec 07 '20 at 09:20

1 Answers1

-1

using the formula =index(IMPORTXML(https://www.bestbuy.com/site/apple-10-2-inch-ipad-latest-model-with-wi-fi-32gb-silver/5199800.p?skuId=5199800,"//span[@class='sr-only']"),1,3) seems to work but as you said it probably gets rate limited by Best Buy

jnjustice
  • 83
  • 1
  • 9