How to Merge Excel Data into Label Templates Without Copy-Paste
You have a spreadsheet with a few hundred rows of product data, and a label design you like. The task sounds trivial: put the right values on the right labels. Then you open the first label, read the SKU from row 1, type it in, read the price from row 1, type it in, and realize you’ve just signed up for several hours of transcription — with a typo guaranteed somewhere around row 87.
This guide shows the other way: turn your Excel file into a live data source, bind it to a label template with variable fields, and generate one correct label per row. No copy-paste, no per-row editing, no drift between spreadsheet and shelf.
The workflow described here uses the managed UI of RSJ LPSNG, the Next Generation Label Printing System by RSJ Software GmbH. It natively accepts Excel files as data and lookup sources. If you already know you want the code-first path (web service API, command-line player, Python field scripts), those exist too — we’ll point at them at the end of the relevant steps, but the steps themselves stay in the UI.
Prerequisites
Before you start, make sure you have:
- Access to RSJ LPSNG — the cloud edition, an embedded edition (for example on a single-board computer), or an enterprise deployment. The core functionality, including the label studio and the job queue, is present in all editions.
- A label template, or five minutes to create one in the label studio.
- An Excel file (.xlsx or .xls) with a header row and one row per label.
- Consistent column names — no trailing spaces, no duplicate headers, no stray merged cells.
- A basic mental model of label fields. You don’t need scripting for a simple merge. You need to know which piece of text or barcode on the label should come from which column.
- Optional: a lookup file. If you want to enrich your main data — pulling a long description, a supplier name, or a category from a second sheet — RSJ LPSNG supports Excel as a lookup source, not just as a data source.
Two things this guide deliberately does not do: it doesn’t teach you the OAuth2 registration flow for connecting external systems, and it doesn’t walk through the raw web service API. Those are the hard way to do a one-off merge. Use them when you need unattended automation, not when you need 400 labels today.
Step 1: Prepare Your Excel Data File
Your spreadsheet is your database. Treat it like one.
Structure it so the first row is a header row, and every subsequent row is exactly one label:
| ProductName | SKU | Price | Barcode |
|---|---|---|---|
| Espresso Blend 250g | ESP-250 | 8.90 | 4012345678901 |
| Filter Roast 500g | FIL-500 | 12.50 | 4012345678918 |
Then clean it up:
- Remove merged cells. Merged cells break row-wise mapping because a row can no longer be read as a flat set of values.
- Delete blank rows in the middle of your data range. A blank row is a label with nothing on it.
- Normalize header names.
Product NameandProductNameare different columns as far as a mapping layer is concerned. Pick one convention and stick to it — no spaces, no punctuation, matching the case you’ll use later. - Watch special characters. Non-ASCII characters (umlauts, accented letters, currency symbols) need consistent encoding. Save your file as UTF-8 and keep the encoding the same through the whole chain.
- Save as .xlsx and note the sheet name if the workbook contains more than one sheet.
A quick sanity check before you upload anything, from a shell with Python and pandas available:
python - <<'PY'
import pandas as pd
df = pd.read_excel("products.xlsx", sheet_name="Data")
print("columns:", df.columns.tolist())
print("rows:", len(df))
print("blank rows:", df.isna().all(axis=1).sum())
print("duplicate headers:", df.columns.duplicated().any())
PY
If the row count matches what you expect and there are no blank rows, move on.
If your label data lives in several tables that you’d rather not paste into one sheet, don’t — keep one clean data file and plan to join the rest as a lookup file in Step 3.
Step 2: Design Your Label Template with Variable Fields
Open the label studio and create a new template, or open an existing one.
The important part is this: text, barcode, and image elements on the label must be variable fields, not static text. A static text element says “Espresso Blend 250g” forever. A variable field says “whatever the ProductName column says for this row.”
So:
- Add your elements at the positions and sizes you want.
- Mark each one as a variable field / placeholder.
- Name each field to match its Excel column header exactly. Field
ProductNamemaps to columnProductName. This naming step is what makes the whole merge work, and it’s where most first attempts fail — see Troubleshooting. - For barcodes, choose a supported 1D or 2D format and bind the element to the SKU or barcode column. The format matters: an EAN-13 barcode expects 13 digits, so binding it to a column of free-text SKUs will produce something that prints but doesn’t scan. The supported formats are documented in the barcode formats reference, and there’s a separate walkthrough on verifying barcode quality before printing if you want to catch problems before they reach the printer.
Save the template. You now have a layout with named holes in it.
Step 3: Connect Excel as a Data Source
In the print job or template settings, select Excel as the data source type.
Then:
- Provide the file. Upload your
.xlsxor point at a file location, depending on which edition you’re running — the cloud edition takes an uploaded file, while an embedded or on-premises deployment may read from a path you control. - Select the sheet, if the workbook has more than one.
- Map each variable field to its Excel column. The interface shows a preview of the first row so you can confirm the binding visually before committing to a full run. This preview is your cheapest error check in the entire process.
- Add a lookup file (optional). Specify a second Excel file and the key column to join on — typically
SKU. Fields that only exist in the lookup file then become available for mapping, so a short code in your data file can resolve to a full product description on the label.
Save the data source configuration alongside the template.
Step 4: Generate and Print Labels
Now choose your output. RSJ LPSNG can produce PDF, render PNG, print directly, or drive electronic shelf labels if that’s your target medium.
Pick the rows you want:
- All rows — the common case for a full production run.
- A row range — useful for splitting a large job or reprinting a section.
- Filtered rows — for example, only the SKUs that changed since the last run.
Start the job. The system processes each row, replaces every placeholder with that row’s values, and emits one label per row. A 400-row spreadsheet becomes 400 labels in a single job.
If you outgrow the button-pressing, the same task can be triggered from code: the web service interface accepts print jobs and can render individual labels as PDF or PNG, and the LPSNG Player is a standalone command-line engine that takes a package and data and produces PDF, PNG, JSON, a direct print, or ESL output. You don’t need either one for a merge like this — but when the source of truth is an ERP instead of a person with a spreadsheet, that’s where they earn their keep.
Step 5: Verify the Merge Worked Correctly
Before you print 400 labels on real stock, verify:
- Row count matches. Use the job queue or logs to confirm the number of generated labels equals the number of data rows.
- Spot-check the edges. Open the first label, the last label, and one from the middle. Edge rows catch off-by-one mapping errors that a first-row preview won’t show.
- Check for empty values. A field that renders as blank usually means a mapping that never bound, or an empty cell in the source data.
- Check for truncation. Long values can overflow a fixed-size text element. If your description field is variable-length, make the element wide enough or shorten the data at the source.
- Scan a barcode. Not visually — with a scanner. A barcode that renders but doesn’t decode is worse than no barcode.
- Confirm lookup joins. If you used a lookup file, check that joined fields (the description, the supplier, the category) actually appear, and that a missing key doesn’t silently produce a blank.
Once those six checks pass, the merge is trustworthy.
Troubleshooting Common Issues
| Symptom | Likely cause | Fix |
|---|---|---|
| Fields render empty | Variable field name doesn’t match the column header | Rename the field or the header so they match exactly |
| Some labels missing, others duplicated | Blank or merged rows in the spreadsheet | Clean the data file and re-upload |
| Upload fails or data looks stale | The .xlsx is still open in Excel (file lock) |
Close Excel, save, and upload again |
| Garbled characters | Encoding mismatch on non-ASCII data | Save/export as UTF-8 and keep encoding consistent |
| Barcode prints but won’t scan | Format and data mismatch (e.g. EAN-13 needs 13 digits) | Match the format to the data, then verify print quality |
| Job takes very long or times out | Thousands of rows in one job | Split the file into batches, or move to the web service API for batch processing |
Case sensitivity is the sneakiest of these. Depending on the edition, productname and ProductName may not be treated as the same field name. Decide on a convention in Step 1 and use it verbatim in Step 2.
FAQ
Can I use multiple Excel sheets or files in one print job?
RSJ LPSNG supports Excel files as data and lookup sources. You can use one main data file plus one or more lookup files to enrich your labels. Whether you can address multiple sheets within a single workbook depends on the edition — check the Excel interface documentation for the specifics of your deployment.
How do I update labels when my Excel data changes?
Replace the file in the data source settings, or re-upload the updated workbook. The next print job uses the new data — there’s no template change required as long as the column structure stays the same. For unattended workflows you can trigger the new job through the web service API or the LPSNG Player.
Is it possible to merge data from Excel and a database?
The Excel interface is built around Excel files as data and lookup sources. For a database, the usual pattern is to export the query result to Excel and use that as your data file, or to skip the file entirely and submit the data programmatically via the web service API. The Python field script API is available when you need advanced data manipulation during rendering.
What if my label template needs conditional logic based on Excel values?
You can attach Python script blocks to individual label fields using the Python API. Those scripts can read and modify a field’s value before printing — which is how you get conditional formatting, unit conversions, or computed values derived from Excel data. Illustrative shape:
# Illustrative: a field script can read and rewrite its value before printing
value = (field.value or "").strip()
if value == "":
field.value = "N/A"
elif value.startswith("PROMO-"):
field.value = value.upper()
Keep logic in the script rather than in the spreadsheet when the rule is really about how the label looks.
From Spreadsheet to Shelf Without the Grind
You’ve now got the full loop: a clean .xlsx, a template whose fields are named after your columns, an Excel data source with a field mapping you can preview, and a print job that turns every row into its own label. The same setup handles lookup files for enrichment, barcodes bound to real columns, and electronic shelf labels as an output target — so the workflow scales from a five-row test to a full production run without changing shape.
That’s the point of using a label platform rather than a mail-merge macro: the data stays in the format your team already maintains, and the labels stay correct. For warehouse and fulfillment scenarios where this runs continuously across devices, the packaging lines workflow builds directly on what you configured here.
Try it on your own file: run the cloud edition with a small export first, confirm the preview mapping, then scale up. The Excel interface documentation covers lookup files and the finer details when you’re ready to go further.
Related posts
- White Label Label Printing: Build vs Partner for Manufacturers
- Label Printing Software for Warehouse Packaging Lines
- How to Verify Barcode Quality Before Printing Labels
