How to name QR code files from a spreadsheet column
Here is the moment that ruins an otherwise successful bulk QR job. You
upload 400 rows, download the ZIP, extract it — and find 400 files named
qr_code_1.png through qr_code_400.png. The
codes are correct. They are also, practically speaking, useless, because
matching file 287 back to row 287 of a spreadsheet you have since sorted
is a job nobody wants.
Naming files from a column of your own data fixes this at the source. This guide covers how to do it and, more importantly, how to choose a column that will not cause problems.
Doing it
Upload your CSV to the generator. Two dropdowns appear, both populated with your real column headers. The second one — "Column to name files after" — is the one that matters here. Pick any column and every output file takes its name from that row's value in that column.
With this CSV:
url,employee_id,department
https://intranet.example.com/staff/10432,E10432,Sales
https://intranet.example.com/staff/10433,E10433,Sales
https://intranet.example.com/staff/10434,E10434,Support
choosing employee_id gives you
E10432.png, E10433.png,
E10434.png. Choosing department gives you
Sales.png, Sales_2.png,
Support.png — which is a good illustration of why the choice
of column matters.
Choosing a good column
The right column is the one you will use to look the file up later. Ask yourself: when someone says "I need to reprint the code for X", what is X? That is your column.
| Job | Good filename column | Why |
|---|---|---|
| Asset tags | Asset ID | Matches the number stamped on the equipment |
| Event badges | Attendee ID or full name | Matches what the badge template merges on |
| Product inserts | SKU | Matches the packaging line's own reference |
| Hotel rooms | Room number | Matches the physical door |
| Property listings | MLS or listing number | Unique and already in every other system |
Avoid columns that describe categories rather than individual rows —
department, region, status, product type. They repeat, and while the tool
handles that safely, Sales_37.png tells you nothing about
which salesperson it belongs to.
What happens to your values
Characters get sanitised
Anything that is not a letter or a number becomes an underscore, runs of underscores collapse to one, and leading and trailing underscores are trimmed:
| Column value | Filename |
|---|---|
ada@example.com |
ada_example_com.png |
Room 12-B |
Room_12_B.png |
SKU/4471 (blue) |
SKU_4471_blue.png |
Ada Lovelace |
Ada_Lovelace.png |
This is not fussiness. Forward slashes are path separators on macOS and Linux; colons and question marks are illegal on Windows; leading spaces break command-line tooling. A filename that survives every operating system is worth the loss of punctuation.
Duplicates get a suffix
If two rows produce the same name, the second becomes
name_2.png, the third name_3.png, and so on.
This is a safety feature with real consequences. A ZIP archive cannot hold two entries with the same path — the second silently replaces the first. Without suffixing, a CSV with 400 rows and 30 duplicate values in the filename column would produce a ZIP with 370 files, and you would most likely not notice until the missing labels turned up as gaps in a print run.
If you see unexpected _2 suffixes, treat it as a signal that
your identifier column is not as unique as you assumed. That is worth
knowing before the codes are printed.
Empty values fall back to numbering
A row with a blank value in the chosen column gets
qr_code_N.png, where N is its position in the batch. The
code is still generated — the row is not skipped — it just has no name to
take.
Using the prefix
Once you select a filename column, a prefix field appears with
qr_ in it. Whatever you put there is prepended to every
filename before sanitising, so badge- plus
E10432 produces badge_E10432.png — note that
the hyphen in the prefix is sanitised along with everything else.
Prefixes earn their keep in three situations:
- Sorting. Files sharing a prefix cluster together in a folder that also contains other assets.
- Searching. Typing the prefix in a file dialog filters to just this batch.
-
Batch distinction. Generating codes for two events?
Prefix one
spring_and the otherautumn_and you can safely keep them in one folder.
Clear the prefix field entirely if you want bare values —
E10432.png rather than qr_E10432.png. This is
the right choice when another system will consume the files by exact
name.
Why this matters for mail merge
The payoff for all of this is automation. Word, InDesign, LibreOffice and
most label software can merge an image by filename from a data field. If
your badge spreadsheet has an attendee_id column and your QR
images are named after that same column, the merge field can build the
image path directly — no manual placement, no lookup table, no
reconciling row numbers.
That only works if the names match exactly, which is the argument for clearing the prefix and choosing the column your other system already uses as its key.
Manual entry works the same way
On the "Enter manually" tab, each row has its own filename field instead
of a column picker. Leave it blank for numbered naming. The same
sanitising and duplicate rules apply — which is what makes
a row with 20 copies
produce menu.png through menu_20.png rather
than a single overwritten file.