Disclosure: I make ZebraSheet at Murabyte, which is mentioned at the end.

Many label printers that understand ZPL listen on TCP port 9100. That means you can print without a driver by sending text to the printer's IP address. Here is a small Python script that prints one label per row of a CSV file.

A minimal ZPL label

^XA ^FO50,40^A0N,40,40^FDItem: BOLT-M8^FS ^FO50,100^BCN,100,Y,N,N^FDBOLT-M8^FS ^XZ 

^XA starts a label, ^FO sets the position, ^A0N picks the font, ^FD...^FS is the field text, ^BC is a Code 128 barcode and ^XZ ends the label.

The script

import csv, socket PRINTER = ("192.168.1.50", 9100) # your printer's IP TEMPLATE = ( "^XA" "^FO50,40^A0N,40,40^FD{name}^FS" "^FO50,100^BCN,100,Y,N,N^FD{sku}^FS" "^XZ" ) def clean(text): # ^ and ~ are control characters in ZPL return text.replace("^", " ").replace("~", " ") with open("items.csv", newline="", encoding="utf-8") as f, \ socket.create_connection(PRINTER, timeout=5) as s: for row in csv.DictReader(f): zpl = TEMPLATE.format(name=clean(row["name"]), sku=clean(row["sku"])) s.sendall(zpl.encode("utf-8")) 

Things that go wrong

  1. Control characters in your data. A ^ or ~ in a product name breaks the label, so strip them as above.
  2. Non-Latin text. Default printer fonts may not show Arabic or other scripts. Test with real data first.
  3. Wrong printer address or blocked port. If the connection times out, check the IP, that the printer is on the same network, and that port 9100 is open.
  4. Label size. Set the print width and length on the printer or with ZPL commands, or the layout will be cut off.

Preview before you print

You can paste ZPL into an online ZPL preview renderer to check the layout before using real labels.

If you want a ready-made tool

ZebraSheet is a Windows app I make at Murabyte. You load an Excel or CSV file, map columns to label fields, design the label (text, Code 128, Code 39, EAN-13, UPC-A, QR, Data Matrix), preview it and print over the network (port 9100), through a Windows printer or save the ZPL. Honest note: the ZPL is checked against the Labelary preview but has not been tested on a physical Zebra printer yet, so use the free 15-day trial first. It is $49 one time: https://murabyte.gumroad.com/l/zebrasheet

python #zpl #csv #barcode #murabyte

Written with AI assistance and reviewed by Murabyte.