Turn a CSV of product names, SKUs and copy counts into a label PDF in two steps: convert the file to the API’s JSON structure, then submit it against a saved template. This workflow sends JSON to Gookit; it is not a direct CSV-upload endpoint.
The sample file contains two products and requests three labels:
name,sku,quantityTrail Bottle,TB-1042,2Desk Tray,DT-2006,1Prepare the files
Use Python 3.10 or newer. The converter and PDF client use Python’s standard library, so this example needs no Python package installation. Create the name/SKU template using the batch guide and keep its template ID.
The template binds name and sku. Adding a price column to the CSV alone will not add a price to the PDF: update the mapper and template if you want to print another field.
Keep identifiers as text
Format SKU columns as text before entering or importing values into a spreadsheet. The converter preserves 0001042 if those characters are present in the CSV. It cannot recover leading zeros that a spreadsheet already removed.
Use UTF-8 CSV with a header row. Quoted names containing commas work through Python’s CSV parser; splitting each line on a comma would break them. The converter accepts a UTF-8 byte-order mark, trims surrounding field whitespace and rejects blank names, blank SKUs, fractional quantities and zero quantities.
Convert and inspect before submitting
Run this in a new folder containing the downloaded files:
export TEMPLATE_ID="YOUR_SAVED_TEMPLATE_ID"python3 csv-to-batch.py products.csv "$TEMPLATE_ID" > batch.jsonIf conversion reports an error, stop and fix that row. Do not submit a partially written output file. On success, inspect batch.json: it should have two items with quantities 2 and 1, and the total should be three.
The converter rejects batches above 1,000 labels. For a larger export, deliberately split the source into smaller files and keep a record of which parts were submitted. Splitting does not bypass per-key rate limits.
Generate the PDF once
Set your independent developer key locally, then submit:
export GOOKIT_API_KEY="YOUR_DEVELOPER_API_KEY"python3 labels.py submit batch.json csv-labels.pdfThe script saves csv-labels.pdf.job.json after acceptance, checks the same job, and downloads the PDF without sending your API key to the storage host. If status checking or download stops, use:
python3 labels.py resume csv-labels.pdf.job.json csv-labels.pdfIf the submission itself timed out and no job ID was saved, investigate before another POST. Running the submit command twice creates two requests; a filename does not make a request idempotent.
Check the exported labels
With the 50 × 30 mm ROLL template, the example should produce three pages: Trail Bottle, Trail Bottle, Desk Tray. Check their visible names and scan the digital barcode values before testing your own stock at Actual Size.
For the next batch, reuse the saved template and replace the CSV records. Keep the old input file with your own internal print record when repeatability matters; decide whether a later reprint should use the original values or current product data.