Note details

Who Knew Excel has 2 Hidden QR code Makers (Python is one)

BY jeyc7
July 14, 2025
Public
Private
8517 views

Overview: Creating QR Codes in Excel

This document outlines two primary methods for generating QR codes directly in Microsoft Excel, utilizing Excel’s built-in features and Python integration.


Method 1: Using the IMAGE Function with a Free API

Key Points

  • No Add-ins Required: Utilizes Excel’s core IMAGE function.
  • External Service: Relies on the free goqr.me API.
  • Bulk Generation: Easily generate multiple QR codes by dragging down formula.
  • Customization Available: Parameters such as size and color can be modified by referring to documentation.
  • Implementation Steps:
    1. Prepare a list of links/data in Excel cells.
    2. Compose formula:
      =IMAGE("https://api.qrserver.com/v1/create-qr-code/?data=" & [CellWithData])
      
    3. Use anchoring (F4) to fix the API URL reference for easy copying.
    4. Drag formula down to generate multiple QR codes.
  • Limitations:
    • Depends on an external, non-Microsoft service.
    • Not as flexible as Python-based approach.

Method 2: Using Python Integration in Excel (Excel 365)

Key Points

  • Python Availability: Integrated into Excel 365; accessible through the Formulas tab (“Insert Python”).
  • Library Needed: Requires the qrcode Python library (and optionally Pillow for advanced customization).
  • Advantages:
    • Greater customization: Control color, error correction, size, and more.
    • Can create standard, colorful, or even fancy QR codes.

Basic Workflow

  1. Import QR Code Library (one-time):

    import qrcode
    
    • Run via =PY(...Python code...) in Excel cell.
  2. Generate Simple QR Code:

    qrcode.make([CellWithData]).show()
    
    • Use PY mode to execute inside Excel.
    • Resulting image can be inserted as an Excel value.
  3. Generate Colorful QR Codes:

    • Reference cell values for colors (e.g., fill_color, back_color).
    • Example code:
      qr = qrcode.QRCode()
      qr.add_data([CellWithData])
      qr.make_image(fill_color=[CellWithFillColor], back_color=[CellWithBackColor]).show()
      
  4. Batch Processing:

    • Place code/formulas inside an Excel table.
    • Drag down to auto-generate QR codes for multiple entries.

Advanced Customization (Fancy QR Codes)

  • Use Pillow (Python Imaging Library):
    • Import Pillow to manipulate images.
    • Allows pixel-level customization (gradient, multi-color, etc.).
    • General steps:
      1. Create QR code with qrcode.
      2. Modify pixel colors using Pillow.
      3. Integrate into Excel via Python mode.

Tips & Additional Notes

  • Documentation: Further customization (e.g., size, color) available in respective API and library documentation.
  • Excel Table Compatibility: All methods work within Excel tables; auto-fill formulas are supported.
  • AI-Assisted Coding: For complex customizations, leveraging AI tools can simplify code generation.

Summary Table

| Method | Requirements | Customization | Bulk Creation | Works in Table | Notes | |----------------|---------------------------|----------------------|---------------|----------------|-----------------------------------| | IMAGE + API | Excel (IMAGE function) | Limited (via API) | Yes | Yes | Needs internet, external service | | Python (365) | Excel 365 + Python | High (color, style) | Yes | Yes | Python integration required |


You can choose between a quick, formula-based approach (Method 1), or leverage Python for more advanced and colorful QR code generation (Method 2), right inside Excel.

    Who Knew Excel has 2 Hidden QR code Makers (Python is one)