Skip to content

Decodo/amazon-price-scraping-google-sheets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Amazon Price Scraping to Google Sheets

Python Version License

Step-by-step guide to scraping Amazon prices into Google Sheets.

What is Amazon Price Scraper?

Amazon Price Scraper for Google Sheets is a comprehensive tool to extract product prices from Amazon and automatically import them into Google Sheets. Track price changes, monitor competitor pricing, and set up automated alerts using multiple scraping methods - from simple ImportXML formulas to advanced Python APIs with proxy rotation.

Perfect for eCommerce businesses, deal hunters, market researchers, and anyone who needs real-time Amazon price tracking directly in their spreadsheets.

✨ Features

  • Multiple scraping methods. Choose from ImportXML, Google Apps Script, or Python API based on your technical needs and scale requirements.
  • Real-time price tracking. Monitor Amazon price fluctuations automatically with scheduled updates and instant notifications.
  • Anti-blocking measures. Built-in proxy rotation and browser fingerprinting to avoid IP bans and CAPTCHAs.
  • Google Sheets integration. Seamlessly import structured price data directly into spreadsheets for analysis and reporting.
  • Bulk price extraction. Process multiple products simultaneously with support for thousands of ASINs and product URLs.
  • Historical price analysis. Track price trends over time and identify optimal buying opportunities.

πŸš€ Quick start

ImportXML (no-code solution)

  1. Open Google Sheets and create two columns:
  • Column A: Product URL
  • Column B: Price
  1. Add an Amazon product URL to cell A2.
  2. Use this formula in cell B2:
=INDEX(IMPORTXML(A2,"//span[@class='a-offscreen']"),1)
  1. Copy the formula down for multiple products.

Python API (Advanced)

  1. Install Requests:
pip install requests
  1. Get your authentication token from the Decodo dashboard.
  2. Run the scraper:
python amazon_scraper.py

πŸ“¦ Installation

Prerequisites

Step-by-step setup

  1. Clone the repository:
git clone https://github.com/Decodo/amazon-price-scraper-google-sheets.git 
cd amazon-price-scraper-google-sheets
  1. Install Python dependency:
pip install requests
  1. Get your Decodo auth token from the dashboard and update it in the Python script.

πŸ› οΈ Methods

Method 1: ImportXML formula

The simplest approach using Google Sheets built-in functions.

Basic formula:

=INDEX(IMPORTXML(A2,"//span[@class='a-offscreen']"),1)

With error handling:

=IFERROR(INDEX(IMPORTXML(A2,"//span[@class='a-offscreen']"),1),"Price not found")

Limitations:

  • Daily usage limits
  • May not work with all Amazon pages
  • Amazon's anti-bot measures can block requests

Method 2: Google Apps Script

For more control and scheduled updates within Google Sheets.

  1. Open Extensions β†’ Apps Script in Google Sheets
  2. Copy and paste the provided google_apps_script.js code
  3. Save and run the script to populate price data
  4. Set up triggers for automated daily updates

The script automatically:

  • Fetches URLs from Column A.
  • Extracts prices using regex patterns.
  • Updates Column B with price data.
  • Handles errors gracefully.

Method 3: Python API

For large-scale operations with advanced anti-blocking capabilities.

  1. Pull the code:
git pull https://github.com/Decodo/amazon-price-scraping-google-sheets/blob/main/amazon_scraper.py
  1. Replace the placeholders:
  • [YOUR_AUTH_TOKEN] - Your Decodo API authentication token.
  • B084ZGRDM5 - The Amazon ASIN you want to scrape.

πŸ“Š Output Example

image

The scraper extracts structured price data, including:

  • Product title and description
  • Current price and original price
  • Availability status
  • Product ratings and review count
  • Seller information

πŸ“ Project structure

amazon-price-scraper-google-sheets/
β”œβ”€β”€ πŸ“œ amazon_scraper.py              # Python API scraper
β”œβ”€β”€ πŸ“œ google_apps_script.js          # Google Apps Script code
β”œβ”€β”€ πŸ“œ README.md                      # Documentation
└── πŸ“œ LICENSE                        # MIT License

πŸ”§ Configuration

Python API authentication

Get your authentication token from the Decodo dashboard:

  1. Sign up for a Decodo account.
  2. Navigate to the Scraping APIs section.
  3. Choose a plan (7-day free trial available).
  4. Copy your auth token and replace [YOUR_AUTH_TOKEN] in the code.

ASIN vs URL

The Python API uses ASINs (Amazon Standard Identification Numbers):

  • Find the ASIN in the product URL: amazon.com/dp/B084ZGRDM5
  • Use just the ASIN: B084ZGRDM5

Google Apps Script and ImportXML use full product URLs.

⚠️ Limitations & best practices

  • ImportXML limitations. Google Sheets has daily limits and may not work with JavaScript-heavy pages.
  • Rate limiting. Add delays between requests to avoid IP blocks.
  • Anti-detection. Use the Python API method for large-scale scraping as it includes proxy rotation.
  • Structure changes. Amazon updates its HTML structure regularly, which may break ImportXML selectors.

πŸ†˜ Troubleshooting

Common Issues

ImportXML shows #N/A:

  • Try alternative selectors or add error handling
  • Amazon may be blocking the request

Google Apps Script returns "Price not found":

  • Check if the URL is accessible
  • Amazon's anti-bot measures may be active

Python API authentication error:

  • Verify your auth token is correct
  • Check if your account has an active plan

πŸ“– Documentation

For advanced usage and tips, check out the complete blog post and API documentation.

πŸ“ License

This project is licensed under the MIT License.

πŸ”— Related repositories

Explore more web scraping tools:

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •