Scrape price data from eBay

With our custom-built function, ImportFromWeb, you can easily scrape and extract data from eBay. Whether your website is competing with this marketplace or because you are directly selling there, it can be interesting to watch closely your competition. 

In this tutorial, we’ll explain how you can scrape useful data quickly without having to worry to write complex code. It will be as easy as using a regular Excel function! 

How does it work? 

Our function, build on top of Google Sheets extending its functionalities, can extract any element available on a webpage. You can retrieve directly in Google Sheets any information you need and cross it with other data sources. How cool is that? 

The only pieces of information you need are: 

  1. An URL or a list of URLs you want to scrape data from 
  2. The Xpath of the elements you want to extract. If you are not familiar with this concept, don’t be afraid because we’ll provide them to you during this tutorial. 

What are we going to scrape from eBay? 

One of the most common data we want to scrape from eBay are the key elements that can trigger or prevent a purchase, like the price and the availability. Let’s see how we can get this information directly into Google Sheets by simply using the ImportFromWeb function. 

1. Get the product URLs we are going to scrape  

The first step to scrape data from a list of products from eBay is simply to get their URLs. Select the product you want to extract data from and save their URLs. 

Please note that you can use a shorter URL, using the eBay item number to build the URL: 

https://www.ebay.com/itm/202905303442
https://www.ebay.com/itm/{{ebay_item_number}}

We advise using this structure to avoid using a very long URL in your spreadsheet, even if there is no impact on how to follow the rest of this tutorial. 

2. Include them in a Google spreadsheet 

Once you have defined all the product URLs you want to scrape, include them in a Google spreadsheet: 

Our formula will use this list as a crawler does: crawl them one by one and extract the data identified by the Xpath provided at the next stage. 

3. List the Xpath you need 

As explained at the beginning, if you want to scrape data from eBay using ImportFromWeb, you need to find the Xpath of the elements you want. 

We created the following for you: 

  • Price: //*[@id=”prcIsum”]
  • Title: //*[@id=”itemTitle”]
  • Item condition: //*[@id=”vi-itm-cond”] 
  • Return policy: //*[@id=”vi-ret-accrd-txt”]

If you need to extract something else, you can follow our Xpath tutorial or get in touch with us and we’d be happy to help. 

4. Add the Xpath to the Google Sheets 

These Xpath will be used by our formula, hence you need to add it to the Google Sheets you use to extract your data. 

5. Install and activate ImportFromWeb

To use our custom formula, you need to install it from the Google Marketplace and then activate it under Add-ons > IMPORTFROMWEB > Activate add-on. 

This step is mandatory to be able to use the formula. 

6. Run the function

We can now run our function, which needs only two parameters to work correctly: 

=IMPORTFROMWEB(url_to_crawl;Xpath_of_elements_to_scrape)

How simple and cool is that?

To compare easily the scraped information, just add headers to your table:

And then use the function. Here we use a TRANSPOSE() function with our ImportFromWeb because, by default, results are stacked vertically and not horizontally. 

But as you can see, data are successfully and easily scraped into your Google Sheets. You can obviously scrape more than 3 URLs, it depends on your need! 

You can even schedule the update of your Google Sheets fields (every hour, every day…) to ensure you always have up-to-date information, which is very important if you are comparing yourself with the competition.