How to Print Labels From Google Sheets Automatically
Your label data already lives in Google Sheets. The rows are there, the columns are consistent, and every week someone still exports a CSV, uploads it somewhere, and clicks Print. This guide is about removing that person from the loop.
By the end, you’ll have a repeatable pipeline: a sheet that acts as the data source, a label design in RSJ LPSNG that maps to your columns, and a trigger that submits print jobs — to a printer, a PDF, or a PNG — whenever your data changes. RSJ LPSNG (lpsng.rsj.de) is the managed label design and printing platform that connects the two sides: it ships a Google Sheets Add-on for interactive use and a web service API for automation, so you never touch the print path manually again.
This is written for developers and spreadsheet power users who need recurring labels — product labels, shipping labels, order-specific labeling — not a one-off print run.
Prerequisites
Before you start, make sure you have:
- A Google account with access to Google Sheets and permission to install add-ons.
- An RSJ LPSNG account (cloud or embedded edition) with access to the label design studio and the Google Sheets Add-on.
- Basic familiarity with Google Sheets functions. Google Apps Script knowledge is optional but required for full automation.
- Label data organized in a sheet: one row per label, with columns for the fields your label needs.
- For API-driven automation: OAuth2 credentials for the LPSNG web service. See the OAuth2 documentation for the simplified registration flow.
Step 1: Prepare Your Google Sheet as a Data Source
Start with the data, not the design. A predictable sheet is what makes everything downstream boring — in the good way.
Structure it with a single header row and one row per label:
| SKU | ProductName | Price | Barcode |
|---|---|---|---|
| RSJ-1001 | Espresso Beans 250 g | 8.90 | 4006381333931 |
| RSJ-1002 | Filter Papers 100 pcs | 4.50 | 4006381333948 |
A few rules that save time later:
- One row = one label. Don’t merge cells; merged cells break range reads in Apps Script.
- Consistent column types. If
Priceis a number, keep it a number. Mixed types produce unpredictable formatting on the label. - Header names are your field names. You’ll bind label fields to these headers, so
ProductNameis better thanName(with a trailing space). - Keep lookup data separate. If a product master or price list lives in another tab or range, keep it there and join it at read time. LPSNG’s Excel interface supports lookup files for spreadsheet-driven printing, and the same separation of concerns applies to Sheets.
- Use named ranges for the data block (e.g.
LabelData) if you plan to script against it. It survives row insertions better thanA2:E500.
Step 2: Design Your Label in LPSNG
Open the LPSNG label studio and create a new layout — or start from an existing template if one matches your label stock.
Then bind the fields:
- Drop a text element onto the canvas and bind it to the
ProductNamecolumn. - Add another for
Price, and format it the way you want it to appear on the physical label. - Add a barcode or QR element and bind it to
Barcode. RSJ LPSNG supports both 1D and 2D barcode formats — the full list is in the Barcode Formats documentation. - Save the design and note the label ID or name. This is the handle you’ll pass to the add-on and to the API.
Optional but useful: the Field Script API lets you attach a Python script block to a field so values are transformed before printing — trimming whitespace, uppercasing a SKU, or concatenating a name and a variant. The exact object names and methods are documented under the Python API; the shape of a field script is roughly:
# Illustrative only — see the Field Script API docs for the real object names.
value = field.value.strip()
field.value = value.upper()
Keeping formatting logic in the label design means your sheet stays clean data and your print output stays consistent.
Step 3: Connect Google Sheets to LPSNG with the Add-on
This step proves the whole path works before you automate it.
- Install the RSJ LPSNG Google Sheets Add-on from the Google Workspace Marketplace.
- Open your data sheet and launch the add-on from the Extensions menu.
- Authenticate against your LPSNG account when prompted. This runs through the OAuth2 flow — the same simplified registration protocol described in the OAuth2 documentation.
- Select the label design you saved in Step 2.
- Map your sheet columns to the label fields. If your headers match your field bindings, this is mostly a confirmation step.
- Print or export labels for a handful of selected rows.
If that produces correct labels, the mapping is right. Everything in the next two steps is just calling the same operation without a human present.
The hard way: export the sheet to CSV by hand, upload it to a print queue, repeat on every change. LPSNG replaces that with a single add-on action — or a single API call.
Step 4: Automate Printing with Triggers or the Web Service API
For scheduled or event-driven printing, move to the LPSNG web service API from Google Apps Script. The API submits print jobs, renders single labels as PDF or PNG, and can send jobs directly to a printer.
First, confirm how you’ll obtain a token. LPSNG’s OAuth2 model uses a simplified registration protocol designed to connect external systems with a single URL — check the OAuth2 docs for the exact token request your account uses.
Then wrap the submission in a function. The endpoint path and payload schema are defined in the Webservice Interface documentation; the structure below shows the shape of the call.
// Constants — replace with the values from the Webservice Interface docs
const LPSNG_API_BASE = 'https://<your-lpsng-instance>';
const PRINT_ENDPOINT = '<path from the Webservice Interface docs>';
const LABEL_ID = 'product-label-a4';
function getAccessToken() {
// OAuth2 token acquisition — see the OAuth2 documentation.
// Cache the token; do not request a new one per label.
return PropertiesService.getScriptProperties().getProperty('LPSNG_ACCESS_TOKEN');
}
function submitLabels(rows) {
const payload = {
label: LABEL_ID,
// One entry per label to print
data: rows.map(r => ({
ProductName: r.ProductName,
Price: r.Price,
Barcode: r.Barcode
})),
output: 'pdf' // render to PDF/PNG, or send straight to a printer
};
const res = UrlFetchApp.fetch(LPSNG_API_BASE + PRINT_ENDPOINT, {
method: 'post',
contentType: 'application/json',
headers: { Authorization: 'Bearer ' + getAccessToken() },
payload: JSON.stringify(payload),
muteHttpExceptions: true
});
return JSON.parse(res.getContentText());
}
If you’d rather keep the print step local and scriptable, the LPSNG Player is a standalone command-line print engine: package plus data in, PDF/PNG/JSON/print/ESL out. It’s the same label package, driven from a shell instead of an HTTP call.
# LPSNG Player — package + data in, output out
lpsng-player --package product-label.lps --data rows.json --output labels.pdf
Step 5: Set Up Recurring Automation (Time-Driven or On-Edit)
Now attach the trigger. Two patterns cover most cases.
Time-driven — check for new rows every hour. Good for batch-oriented workflows where a few minutes of latency is fine.
function installHourlyTrigger() {
ScriptApp.newTrigger('printNewRows')
.timeBased()
.everyHours(1)
.create();
}
On-edit — print the moment a row is added or changed. Good for order-specific labeling where someone is waiting on the output.
function onEditHandler(e) {
const sheet = e.range.getSheet();
if (sheet.getName() !== 'Labels') return;
if (e.range.getRow() === 1) return; // ignore the header row
printNewRows();
}
Both call the same worker, which is where you handle idempotency. The simplest reliable mechanism is a status column:
const SHEET_NAME = 'Labels';
const STATUS_COL = 5; // column E: blank or "pending" / "printed"
function printNewRows() {
const sheet = SpreadsheetApp.getActive().getSheetByName(SHEET_NAME);
const values = sheet.getDataRange().getValues();
const header = values.shift();
const pending = [];
values.forEach((row, i) => {
const status = row[STATUS_COL - 1];
if (!status || status === 'pending') {
pending.push({
rowNumber: i + 2,
data: Object.fromEntries(header.map((h, c) => [h, row[c]]))
});
}
});
if (!pending.length) return;
const result = submitLabels(pending.map(p => p.data));
// Adjust this check to the response fields your API version returns.
if (result && result.error) {
MailApp.sendEmail('ops@example.com', 'LPSNG print job failed',
JSON.stringify(result));
return;
}
pending.forEach(p => sheet.getRange(p.rowNumber, STATUS_COL).setValue('printed'));
}
For higher volumes, batch rows into a single API call rather than looping one request per row, and let the LPSNG job queue manage and monitor the resulting print jobs.
Step 6: Verify and Monitor Your Automated Printing
Automation you don’t watch is automation you don’t trust. Four checks keep it honest:
- Job queue. Look at the LPSNG job queue for successful submission and completion of each job.
- Output inspection. Open the generated PDF or PNG and compare it against the source rows — especially barcode values and price formatting.
- Status column. Rows marked
printedare processed; rows left blank orpendingare not. This is both your progress indicator and your duplicate guard. - Error notifications. Wrap API calls in error handling and send yourself a mail on failure. Apps Script’s
MailAppis enough for small volumes; check the execution log under Executions in the Apps Script editor when something silently stops.
Troubleshooting Common Issues
Authentication errors. Tokens expire. Make sure your script refreshes them rather than reusing a stale value, confirm the scopes match what the web service requires, and re-authenticate the add-on if you changed accounts.
Data mapping issues. Column headers must match the field bindings in your label design. A renamed header is the single most common cause of blank fields. Also check for empty or malformed values — an empty barcode cell will produce an unreadable symbol.
Print job failures. Confirm the printer is reachable and that the right printer is selected in LPSNG. For cloud printing scenarios, verify the thermal printer workaround described in the Cloud Printing documentation is configured.
Duplicate labels. Always gate submissions on a status column or a unique job ID per row. On-edit triggers plus retries without a guard will happily print the same label twice.
Performance. Batch requests, avoid firing many jobs in a short window, and use the job queue to smooth spikes rather than hammering the API.
FAQ
Do I need to be a developer to set up automatic label printing from Google Sheets? Not necessarily. The RSJ LPSNG Google Sheets Add-on provides a no-code way to print labels from your sheet. However, for full automation — scheduled or event-driven printing — some scripting with Google Apps Script and the LPSNG web service API is required. The API uses OAuth2 and JSON, so basic development skills help.
Can I print to a physical printer directly from Google Sheets? Yes, through RSJ LPSNG. The platform can send print jobs directly to printers, including thermal printers. For cloud printing scenarios, LPSNG offers a workaround for using thermal printers with Google Cloud Print. You can also render labels as PDF or PNG for manual printing.
What label formats and barcode types are supported? RSJ LPSNG supports a wide range of 1D and 2D barcode formats. You can design labels with text, barcodes, and other elements in the label studio. The exact list of supported barcode formats is available in the LPSNG documentation under Barcode Formats.
Is there a limit on the number of labels I can print automatically? Limits depend on your LPSNG edition and deployment. The cloud solution is multi-user and scalable, while the embedded edition runs on a single-board computer. For high-volume automation, the job queue helps manage print jobs. Check the specific edition details for any constraints.
Conclusion: Streamline Your Label Printing Workflow
The full pipeline is six moves: structure the sheet, design the label, connect with the add-on, automate the submission, attach a trigger, verify the output. Once it’s in place, a new spreadsheet row becomes a printed label with no export step and no copy-paste — and a status column tells you exactly what happened to every row.
RSJ LPSNG is built for exactly this kind of recurring work. Because it’s a managed service, the print path — rendering, job queue, printer dispatch — is handled for you, and the same label design works across cloud, embedded, and enterprise editions depending on where you need it to run.
Start with the Google Sheets Add-on to prove your mapping on a handful of rows, then move to the web service API when you’re ready to remove the manual trigger. Both are documented from the product site.
Related posts
- How to Create QR Code Labels in Bulk Efficiently
- Label Printing for Small Business Owners: A Complete Guide
- Barcode Label Software vs Online Label Maker: Which Is Right for You?
