Scrape price data from Wallmart
With our custom-built function, ImportFromWeb, you can easily scrape and extract data from Wallmart. This website is indeed one of the biggest E-commerce, especially in the US, and it can be interesting to track prices on Wallmart to compare them with your offers and ensure that you stay competitive.
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!
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 Wallmart are the key elements that can trigger or prevent a purchase, like a price. Let’s see how we can obtain this information directly into Google Sheets by simply using the ImportFromWeb function and let the function do the heavy work.
The first step to scrape data from a list of products from Wallmart is simply to get their URLs. Select the product you want to extract data from and save their URLs.
Once you have defined all the product URLs you want to scrape, include them in a Google spreadsheet. In this example, we decided to compare several Microsoft Surface products.
Our formula will use this list as a regular crawler does: crawl them one by one and extract the data identified by the Xpath provided in the following step.
As explained at the beginning, if you want to scrape data from Wallmart using ImportFromWeb, you need to find the Xpath of the elements you want.
We created the following for you:
- Name: //h1
- Price: //*[@id=”price”]/div/span/span/span
- Rating: (//*[@class=’button-wrapper’]/span[contains(itemprop,ratingValue)])
- Number of reviews: (//*[@class=’stars-reviews-count-node’])
- Delivery policy: //*[@id=”add-on-atc-container”]/div/div/span/div/div/div
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.
6) Run the function
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.
All the information that you need to retrieve can be extracted and displayed in your Google Sheets. How cool is that? You can scrape Wallmart easily and track whatever information you need from this website.