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!
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:
- An URL or a list of URLs you want to scrape data from
- 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.
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.
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:
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.
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.
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”]
These Xpath will be used by our formula, hence you need to add it to the Google Sheets you use to extract your data.
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.
We can now run our function, which needs only two parameters to work correctly:
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.