Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Google Sheets ASIN Function: How to Pull Amazon Data

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Google Sheets does not have a native, built-in function called "ASIN()" provided by Google. To achieve an ASIN function—which allows you to automatically pull product titles, prices, or images from Amazon using an Amazon Standard Identification Number (ASIN)—you must use a combination of the IMPORTXML function or a third-party Google Sheets add-on. This allows sellers and researchers to track competitors, manage inventory, and monitor price fluctuations without manual data entry.

What You'll Need

  • A Google account with access to Google Sheets.
  • A list of valid Amazon ASINs (the 10-character alphanumeric unique identifier found in the product URL).
  • A stable internet connection to allow Google's servers to fetch external web data.
  • Basic knowledge of cell referencing (e.g., knowing that A2 refers to the second row of the first column).

Step-by-Step

Since there is no single =ASIN() formula, the most common professional method is using IMPORTXML. This function tells Google Sheets to go to a specific URL, look for a specific piece of data (using an XPath), and bring that data back into your cell. Note that menu labels and interface options may differ slightly depending on your browser version or region.

  1. Prepare Your ASIN Column: Open a new Google Sheet. In column A, create a header called "ASIN". List your target ASINs in the cells below (e.g., cell A2 contains B07XJ8C8F5).
  2. Construct the Amazon URL: Amazon URLs follow a predictable pattern. You need to combine the base Amazon URL with the ASIN cell. In cell B2, you can use a formula to create the link: ="https://www.amazon.com/dp/"&A2. This ensures that if you change the ASIN in column A, the URL updates automatically.
  3. Identify the XPath for the Data: To pull a specific piece of information (like the product title), you need the XPath. The XPath is a path used to find a specific element on a webpage. For most Amazon product titles, the XPath is typically "//span[@id='productTitle']".
  4. Apply the IMPORTXML Function: In cell C2, enter the following formula: =IMPORTXML(B2, "//span[@id='productTitle']"). This tells Google Sheets to go to the URL in B2 and extract the text found within the span element with the ID 'productTitle'.
  5. Pulling the Price: To pull the price, you need a different XPath. Prices are often nested in different tags depending on the product type. A common XPath for the price is "//span[@class='a-price-whole']". In cell D2, enter: =IMPORTXML(B2, "//span[@class='a-price-whole']").
  6. Drag the Formulas Down: Once you have the title and price working for the first ASIN, highlight cells B2, C2, and D2. Click the small blue square in the bottom-right corner of the selection and drag it down to apply the logic to all ASINs in your list.
  7. Cleaning the Data: IMPORTXML often pulls in extra whitespace or hidden characters. To clean this, wrap your formula in the TRIM function. For example: =TRIM(IMPORTXML(B2, "//span[@id='productTitle']")).

Common Mistakes

The most frequent error users encounter is the "Import Content is Empty" or "#N/A" error. This usually happens because Amazon employs aggressive anti-scraping measures. When Google's servers request a page too many times in a short window, Amazon may block the request or serve a CAPTCHA page instead of the product page. Because Google Sheets is performing the request from a data center IP, not your home IP, it is more likely to be flagged.

Another common mistake is using an incorrect XPath. Amazon frequently updates its website layout and changes the HTML IDs or Class names of its elements. If a formula that worked yesterday stops working today, it is likely that Amazon changed productTitle to something else or changed the structure of the price span. Users often forget that XPaths are case-sensitive; typing producttitle instead of productTitle will result in a failure to find the data.

Finally, users often try to pull too much data at once. Attempting to pull titles, prices, ratings, and review counts for 500 ASINs in a single sheet will almost certainly lead to a "Loading..." hang or a total block from Amazon. Google Sheets has a limit on how many external data requests can be active in one workbook.

Tips

To avoid being blocked, limit the number of IMPORTXML functions per sheet. Instead of tracking 1,000 products in one tab, split them across multiple tabs or separate workbooks. This distributes the request load and reduces the chance of triggering a bot detection system.

If you need more reliable data, consider using a dedicated Amazon API tool or a Google Sheets add-on specifically designed for ASIN lookups. These tools use official API keys or rotating proxies to bypass the limitations of IMPORTXML, ensuring that your data doesn't disappear or turn into an error message during a critical business review.

To keep your sheet organized, use Data Validation on your ASIN column. Since ASINs are always 10 characters, you can set a validation rule that alerts you if you accidentally enter a 9 or 11-character string, preventing the IMPORTXML function from attempting to load a broken URL.

For those tracking prices over time, do not rely on IMPORTXML to store history. Because the function is dynamic, it only shows the current price. To create a history log, you would need a Google Apps Script that copies the value from the IMPORTXML cell and pastes it as a static value into a timestamped log daily.

Troubleshooting

If your formulas are returning #N/A or #ERROR, follow these steps in order:

  1. Verify the URL: Copy the URL generated in your sheet and paste it into a private/incognito browser window. If the page loads normally, the URL is correct. If you see a CAPTCHA or a "Robot Check" page, Amazon has temporarily blocked the request.
  2. Check the XPath: Right-click the element you want to pull on the Amazon page (e.g., the title), select "Inspect", right-click the highlighted HTML code, and choose "Copy" > "Copy XPath". Paste this into your formula to see if the ID has changed.
  3. Refresh the Sheet: Sometimes a simple refresh of the browser page forces Google to re-attempt the request. If the cell says "Loading..." for more than a minute, the request has likely timed out.
  4. Reduce Request Volume: Delete half of your formulas and see if the remaining half start working. If they do, you have exceeded the request limit for your account or the target site.
  5. Check for Regional Variations: Ensure the URL matches the marketplace. If you are pulling an ASIN from Amazon UK, the URL must be amazon.co.uk, not amazon.com. Using the wrong domain will result in a 404 error.

Frequently Asked Questions

Can I pull the current stock level using this method?

Pulling exact stock levels is very difficult with IMPORTXML because stock data is often loaded dynamically via JavaScript after the page loads. IMPORTXML only reads the initial HTML source code, so it cannot "see" data that appears after a script runs.

Is using IMPORTXML against Amazon's Terms of Service?

Automated scraping of Amazon's public pages can be against their Terms of Service. While IMPORTXML is a common practice for small-scale personal use, large-scale scraping can lead to your IP or Google's server IP being blocked.

Why does my price keep changing to "Loading..."?

Google Sheets periodically refreshes external data. When it does, it sends a new request to Amazon. If Amazon's servers are slow or if you have too many requests, the cell will hang in the "Loading..." state.

Can I use this to track products on eBay or Walmart?

Yes, the IMPORTXML method works on any website that provides data in HTML. You simply need to change the base URL and find the specific XPath for the title and price on that specific platform.

Is there a way to make the data permanent?

No, IMPORTXML is a live link. To make the data permanent, you must copy the cell and use "Paste Special" > "Values only". This removes the formula and keeps the text as it was at that moment.