+ Reply to Thread
Results 1 to 13 of 13

Scrape Amazon details

  1. #1
    Registered User
    Join Date
    06-25-2014
    Location
    Falkirk, Scotland
    MS-Off Ver
    Office Excel 2013
    Posts
    31

    Scrape Amazon details

    Hi folks

    I am wondering if there is a way that I can scrape Amazon pages by using Excel,
    In column A (Link) I paste the URL: http://www.amazon.co.uk/gp/product/B00FJRHTQ2

    In column B (Artist), I would like to scrape the artist name ("Marc Smith" in this case)
    In column C (Title), I would like to scrape the song title ("Notorious By Nature" in this case)
    In column D (Price), I would like to scrape the price ("£7.49" in this case)

    I will be adding more links to column A and would like the other column to do the same throughout

    Thanks guys!
    Last edited by cfcMalky; 12-05-2014 at 06:04 PM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Scrape Amazon details

    Looking for something?
    We're sorry. The Web address you entered is not a functioning page on our site.

    Go to Amazon.co.uk's Home Page

  3. #3
    Registered User
    Join Date
    06-25-2014
    Location
    Falkirk, Scotland
    MS-Off Ver
    Office Excel 2013
    Posts
    31

    Re: Scrape Amazon details

    Sorry about that, I've edited the original post with a different link

  4. #4
    Registered User
    Join Date
    12-05-2014
    Location
    India
    MS-Off Ver
    2010
    Posts
    13

    Re: Scrape Amazon details

    Sub ScrapeAmazon()

    Dim Ie As New InternetExplorer
    Dim WebURL
    Dim Docx As HTMLDocument
    Dim ArtistName
    Dim Track
    Dim Cost
    Dim RcdNum

    Ie.Visible = False

    For RcdNum = 2 To ThisWorkbook.Worksheets(1).Range("A65536").End(xlUp).Row

    WebURL = ThisWorkbook.Worksheets(1).Range("A" & RcdNum)
    Ie.Navigate2 WebURL
    Do Until Ie.ReadyState = READYSTATE_COMPLETE
    DoEvents
    Loop
    Set Docx = Ie.Document
    Track = Docx.getElementById("Title_row").innerText
    ArtistName = Docx.getElementById("artistBlurb").innerText
    Cost = Docx.getElementById("actualPriceValue").innerText
    ThisWorkbook.Worksheets(1).Range("B" & RcdNum) = ArtistName
    ThisWorkbook.Worksheets(1).Range("C" & RcdNum) = Track
    ThisWorkbook.Worksheets(1).Range("D" & RcdNum) = Cost
    Next

    End Sub

    Here's the code snippet. copy and paste into VBA editor. Also, please add reference to following libraries:

    Microsoft Internet Controls
    Microsoft HTML Object Library

    Cheers

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Scrape Amazon details

    shankarsomajni
    Welcome to the forum!
    Very good code!
    Please note to wrap your code with code tags.
    Please read forum's rule, particularly rule 3-how to use code tags with your code.
    Last edited by AB33; 12-08-2014 at 05:21 AM.

  6. #6
    Registered User
    Join Date
    06-25-2014
    Location
    Falkirk, Scotland
    MS-Off Ver
    Office Excel 2013
    Posts
    31

    Re: Scrape Amazon details

    Thanks!

    I've opened the VB editor, pasted the code in and checked the following references:

    Microsoft Internet Controls
    Microsoft HTML Object Library

    saved the book as a macro-enabled workbook and when I run the sub, nothing happens

    Am I doing something wrong?

    Cheers again!

  7. #7
    Registered User
    Join Date
    12-05-2014
    Location
    India
    MS-Off Ver
    2010
    Posts
    13

    Re: Scrape Amazon details

    AB33

    Will be careful about it

  8. #8
    Registered User
    Join Date
    12-05-2014
    Location
    India
    MS-Off Ver
    2010
    Posts
    13

    Re: Scrape Amazon details

    Ummm..

    Did you copy and paste the URLs to scrape data from in Column A?

    Please start pasting URLs from Cell Number 2 in column A.

  9. #9
    Registered User
    Join Date
    06-25-2014
    Location
    Falkirk, Scotland
    MS-Off Ver
    Office Excel 2013
    Posts
    31

    Re: Scrape Amazon details

    yeah, I'm pasting the URL into cells from A2 downwards, hitting run on the VB module , It says "running" for a few secs but nothing else appears on the sheet

  10. #10
    Registered User
    Join Date
    06-25-2014
    Location
    Falkirk, Scotland
    MS-Off Ver
    Office Excel 2013
    Posts
    31

    Re: Scrape Amazon details

    Got it working

  11. #11
    Registered User
    Join Date
    12-05-2014
    Location
    India
    MS-Off Ver
    2010
    Posts
    13

    Re: Scrape Amazon details

    Glad to know that.

  12. #12
    Registered User
    Join Date
    01-21-2016
    Location
    United Kingdom
    MS-Off Ver
    2016
    Posts
    1

    Re: Scrape Amazon details

    Hi There

    I tried the above and keep getting "Run-Time error "91"

    Any reason for this

  13. #13
    Registered User
    Join Date
    09-22-2016
    Location
    Chennai, India
    MS-Off Ver
    Office 10
    Posts
    1

    Re: Scrape Amazon details

    I am getting "Run-Time error 91" on macro execution. I have added url to be in A2 cell.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 03-31-2020, 01:59 PM
  2. Scrape Amazon listing details into table
    By cfcMalky in forum Excel General
    Replies: 2
    Last Post: 12-05-2014, 04:50 PM
  3. [SOLVED] how can i search and copy details of a particular User details in Sheet1
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-10-2014, 02:58 AM
  4. Replies: 0
    Last Post: 08-21-2012, 01:19 AM
  5. [SOLVED] Any examples of VBA and Amazon Web Services (ECS) Programs???
    By Carl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2005, 02:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1