Using Google’s Xpath scraping with ebay for average cost.

Written by Arujei on . Posted in Latest

Well with Christmas shopping/selling on the way sometimes I like to get the average cost of something that has sold on ebay. Well instead of doing all that math of copy everything I see sold and dividing it by the number of items I copied. I went ahead and scrapped their data into a Google apps spreadsheet to get the answer.

Its easy to do.

1. Go to ebay search for something you want the average price on. Make sure you check “completed listings” within the “buying formats” preferences.

2. Once you get the results you want copy ebay address in your address bar.

3. Either open the Google spreadsheet here and replace the ebay address with your’s.

3b. Or you can make your spreadsheet and copy and paste this. Replacing the ebay address in quotes with your’s.

=average(ImportXML("","//div[@class='g-b bidsold']"))

Even though it goes off the page you can still copy it just fine :3


P.S. take a look at:
This is where I got the basic information on how to grab the data way back when I first found out about this.

Trackback from your site.


I'm your happy go lucky Upbeat average John that's a Jack of all trades and a master of few too many. I'll go on about anime, games, other fandoms, development, technology, and other random stuff.

Comments (4)

  • Shawn


    Did you take down your spreadsheet from Google Docs?


  • silvian


    Please fix the spreadsheet , it is not working as you see in d1 where the formula is , it is giving an error. I really want to use this . thanks


    • Arujei


      Looks like Ebay changed the page layout. I’ve change =average(ImportXML(URL,”//div[@class=’g-b bidsold’]”)) to =average(ImportXML(URL,”//span[@class=’g-b bidsold’]”)) to fix it.


Leave a comment


RT @jenjavajunky: A mother and baby potoroo spotted at South Australia’s Cleland Wildlife Park enjoying a little snack in the sunshine. htt…

John Ramirez John Ramirez