How to Make QR Codes in Bulk: A CSV Workflow

CreationBasic Creation

Published

Share
Illustration for How to Make QR Codes in Bulk: A CSV Workflow

Overview

To make QR codes in bulk, prepare one spreadsheet row per intended code, choose a batch-capable generator or a local script, map each payload to a stable filename, and validate the exported files before distribution. Start with a small pilot batch rather than sending an entire spreadsheet straight to print.

This guide provides a suggested CSV format, a no-code workflow, and an optional Python example. The two sample rows generated PNG files that decoded to the original URLs in a local check. Test a print proof before production.

1. Decide whether you need copies or unique codes

First, define the job:

  • Many copies of one code: Generate one approved image and reuse it in your layout.
  • Many codes with different content: Use a batch workflow with one record per code.
  • Separate records sharing a destination: Give each record its own ID for production tracking, even if the encoded URL repeats.

For URL projects, also decide whether to encode the destination page directly or a stable redirect URL. With a redirect, the printed URL remains unchanged while the server chooses the destination. GS1 documents this separation between a barcode’s encoded identifier URL and its online content. “Dynamic QR code” is a service-layer description—not a printed symbol that changes itself. [1]

Recommended planning questions:

  • Who controls the encoded domain and redirect configuration?
  • Who will maintain the pages after the campaign ends?
  • If using a hosted service, what happens when the account or subscription ends?
  • Do you need analytics, and what exactly does the chosen service measure?

Do not assume that choosing a redirect automatically provides analytics or any particular management feature.

2. Prepare a clean source file

For a URL-only batch, use a simple structure like this:

record_id,payload,caption
item-001,https://example.com/products/001,Product 001
item-002,https://example.com/products/002,Product 002

These are illustrative addresses, not production destinations. The column names are a suggested internal format, not a universal import standard. Adapt them to your chosen generator’s documented template.

Field Purpose Suggested check
record_id Links the source row, image, and printed asset Required; unique; safe for filenames
payload Contains exactly what the QR code should encode Required; approved content or destination
caption Supplies optional text beside the code Matches the intended item; stays outside the quiet zone

Before exporting your spreadsheet as UTF-8 CSV:

  1. Remove unintended blank records and surrounding whitespace.
  2. Preserve identifiers such as 000123 as text.
  3. Review duplicate payloads; allow intentional duplicates rather than deleting them automatically.
  4. For this URL workflow, require complete HTTPS addresses and approved domains.
  5. Preserve URL path capitalization and query parameters unless the destination owner approves a change.
  6. Keep a versioned copy of the approved source file.

Treat contact cards, Wi-Fi configurations, and other structured content as separate payload projects. Segno documents separate helper functions for those formats. The script below accepts only HTTPS links. [2]

3. Choose a generation route

No-code: import, map, preview, export

Use these as selection and production steps—not as instructions for a particular product interface:

  1. Check the tool’s documentation for CSV support, required headers, batch limits, output formats, and charges.
  2. Import a pilot file containing a few representative records, including your longest URL.
  3. Map the payload column to encoded content and the ID column to filenames, if supported.
  4. Select the output settings and preview each pilot record.
  5. Export and confirm that filenames still match source IDs.
  6. Complete the quality checks below before processing the full batch.

If the tool cannot preserve record IDs in filenames, maintain a separate export manifest. Do not rely on download order to match images to labels.

Local script: generate one PNG per row

For a developer-managed workflow, Segno provides QR generation and PNG/SVG export. Its documented make_qr() function creates a regular QR code rather than a Micro QR code. The example below uses that interface. [3]

With Python 3 available, install the package:

python -m pip install segno

The package’s installation documentation specifies installation through pip. [4]

Save the CSV as codes.csv and this script as make_codes.py in the same folder:

import csv
import re
from pathlib import Path
from urllib.parse import urlsplit

import segno

with open("codes.csv", encoding="utf-8-sig", newline="") as source:
    reader = csv.DictReader(source)
    if not {"record_id", "payload"}.issubset(reader.fieldnames or []):
        raise ValueError("CSV needs record_id and payload columns")
    rows = list(reader)

seen = set()
validated = []
for line, row in enumerate(rows, start=2):
    rid = (row.get("record_id") or "").strip()
    payload = (row.get("payload") or "").strip()
    if not re.fullmatch(r"[A-Za-z0-9_-]{1,80}", rid):
        raise ValueError(f"Line {line}: invalid record_id")
    if rid.casefold() in seen:
        raise ValueError(f"Line {line}: duplicate record_id")
    url = urlsplit(payload)
    if url.scheme != "https" or not url.hostname:
        raise ValueError(f"Line {line}: HTTPS URL required")
    if any(char.isspace() for char in payload):
        raise ValueError(f"Line {line}: whitespace in URL")
    seen.add(rid.casefold())
    validated.append((rid, payload))

if not validated:
    raise ValueError("No records found")

output = Path("qr-output")
output.mkdir(exist_ok=False)
for rid, payload in validated:
    qr = segno.make_qr(payload, error="m", boost_error=False)
    qr.save(str(output / f"{rid}.png"), scale=10,
            border=4, dark="black", light="white")
print(f"Generated {len(validated)} files")

Run python make_codes.py. Use a new output folder for each approved run; this example deliberately refuses to reuse an existing qr-output folder.

Here, scale=10 means ten pixels per module in PNG output, and border=4 specifies a four-module border. Neither setting establishes a physical print size. Segno documents these serialization controls separately from the encoded content. [5]

Limits: This script performs preliminary input checks, not complete URL validation. It does not check domain approval, visit destinations, configure redirects, decode its output, create captions, or make a label sheet. An encoding or file-write error can leave a partial batch; investigate the error before rerunning.

4. Set size, margins, and error correction deliberately

Preserve the quiet zone

For the regular QR codes covered here, retain at least four modules of clear space on every side. A module is one small square in the grid. DENSO WAVE specifies this four-module margin; it is not a four-pixel rule. [6]

For layout planning:

Total side length = (symbol modules per side + 8) × module size

For example, a 29-module symbol printed with 0.5 mm modules occupies 18.5 mm per side including its quiet zone: (29 + 8) × 0.5. This is a geometry example, not a universal minimum-size recommendation. DENSO WAVE’s sizing guidance likewise calculates area from module count, module size, and margins. [6]

Keep the grid and contrast intact

Use black modules on white as a conservative starting point. Keep modules square, avoid stretching the image, and keep captions and artwork outside the clear margin. GS1 identifies contrast, uniformity, quiet-zone interference, and artwork overlays as barcode-quality concerns. [7]

Do not automatically choose maximum error correction

DENSO WAVE describes Level M as commonly selected, with Q or H potentially appropriate in dirtier environments. Higher correction adds redundancy and can require a larger symbol. Choose according to the payload, available space, and operating conditions—not simply “highest is best.” [8]

Do not treat higher error correction as permission to crop the symbol or place a logo over it. GS1 treats overlaid images as damage that consumes the symbol’s recovery capability. [7]

5. Validate the batch before release

Use three separate checks. This is a recommended production workflow, not a claim that any batch has been tested here.

Data and file reconciliation

  • Compare the approved record count with the exported file count.
  • Match every filename to its source ID.
  • Decode every exported image where practical and compare the recovered payload with the approved source value.
  • Hold back any missing, unreadable, or mismatched file.

Destination validation

For URL batches, check each intended destination separately. Confirm the correct item or campaign, redirect behavior, and expected access conditions. A page that loads successfully can still be the wrong page. GS1 explicitly distinguishes barcode-quality verification from validation of the resulting web experience. [7]

Final-layout and physical checks

Print a pilot using the actual material, layout, and final dimensions. Include the densest symbols and every distinct placement. Try the intended phones or scanners under realistic lighting and distance, then record failures and revise before the production run.

A successful phone scan is not a formal print-quality grade. Where GS1 retail requirements apply, arrange the appropriate verification process; GS1 references ISO/IEC 15415 for two-dimensional print-quality assessment. [7]

Release checklist

Before approving the batch, retain:

  • The approved CSV and export manifest
  • Generation settings and library version, if applicable
  • Final images and label/document files
  • Decode and destination-check results
  • Pilot-print observations and approval
  • An owner for ongoing URLs and redirects

The goal is not merely to produce hundreds of images. It is to keep a reliable connection between each source record, its encoded content, and the correct finished asset.

References

[1] GS1, Redirection: from scan to content — https://ref.gs1.org/docs/2024/redirection-from-scan-to-content

[2] Segno. Helpers. https://segno.readthedocs.io/en/stable/helpers.html

[3] Segno, API — https://segno.readthedocs.io/en/stable/api.html

[4] Segno package documentation on PyPI — https://pypi.org/project/segno/

[5] Segno, QR code and Micro QR code serialization — https://segno.readthedocs.io/en/stable/serializers.html

[6] DENSO WAVE, Point for determining the code area — https://www.qrcode.com/en/howto/code.html

[7] GS1, 2D Barcodes at Retail Point-of-Sale Implementation Guideline, Release 1.1.0 — https://ref.gs1.org/guidelines/2d-in-retail/

[8] DENSO WAVE, Error Correction Feature — https://www.qrcode.com/en/about/error_correction.html

Ready to create your QR code?

Create QR Code