Python script to process Excel files containing image URLs, download images, detect QR codes, and write results to a new column.
- Python 3.8+
- Homebrew (macOS)
- Install system dependency (zbar):
brew install zbar- Create and activate virtual environment:
python3 -m venv venv
source venv/bin/activate- Install Python dependencies:
pip install -r requirements.txt-
Ensure your Excel file
EXCEL/export_file.xlsxis in the project directory -
Activate the virtual environment (if not already active):
source venv/bin/activate- Run the
qr_processorfirst:[!tip]
This will recognoze most of the QR codes, because it is using QR code reader, and it is the most recommended script, but it made few errors and it didn't classify everything
python qr_processor.pyResults will be saved to output/company_export_processed_YYYYMMDD_HHMMSS.xlsx
- Run
process_qr_codes.pysecond
Tip
The second script which is more using image analysis and qr code reader, it classified few more examples
Results will be saved to: EXCEL/[name]_Analyzed.xsls
- Run
analyze_qr_codes.pythe last
Tip
This is the most basic script, but it managed to recognize the most of the left over QR codes.
Result will be saved to: `EXCEL/[name]_Analyzed.xsls
The script will:
- Add a new column "QR CODE VALUE" to the Excel file
- For each image URL in the first column:
- Download the image
- Detect and decode any QR codes
- Write the QR code value if found
- Write "NOT A STICKER" if no QR code is detected or download fails
Processing logs are saved to logs/processing_YYYYMMDD_HHMMSS.log
.
├── qr_processor.py # Main script
├── config.py # Configuration constants
├── requirements.txt # Python dependencies
├── utils/
│ ├── __init__.py
│ ├── excel_handler.py # Excel read/write operations
│ ├── image_downloader.py # Image download with retry logic
│ └── qr_detector.py # QR code detection/decoding
├── output/ # Generated output files
└── logs/ # Processing logs