Skip to content

Instantly share code, notes, and snippets.

@timothycarambat
Created April 18, 2018 20:54
Show Gist options
  • Save timothycarambat/21e45d53dc1e51e415ee798b56e2f629 to your computer and use it in GitHub Desktop.
Save timothycarambat/21e45d53dc1e51e415ee798b56e2f629 to your computer and use it in GitHub Desktop.
Public Function ASIN_LOOKUP(asin As String) As String
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Top = 0
objIE.Left = 0
objIE.Width = 800
objIE.Height = 600
objIE.Visible = False
objIE.Navigate ("https://www.amazon.com/s?field-keywords=" + asin)
Do
DoEvents
Loop Until objIE.readystate = 4
ASIN_LOOKUP = objIE.document.getElementsByClassName("a-offscreen")(0).innerText
End Function
@timothycarambat
Copy link
Author

This will take a string ASIN in some column by itself only. It will then output the search result from amazon for that ASIN.

NOTE:
This scrapes and queries the search result page and not the item itself since URL generation for a specific item is not easily done without nesting URL scraping. It may return a price range that can then be split or a single cost as a string. It requires no API registration and is liable to break as Amazon updates their UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment