Bulk-Insert Net Labels in KiCad via CSV

Hey Everyone,

I got tired of manually typing out net labels in KiCad one by one, so I threw together a little Python script—labelgen.py—that automates the whole process from a simple CSV. It pops up a quick dialog (backs up your schematic, lets you pick mil/mm and local/global), then reads your “Label” column, uppercases everything, and drops each net label at the top-left outside the title block. No virtualenv wrestling— it even auto-installs its one dependency.

Figured it might save someone else some time, so I’m sharing it here. Feel free to grab it, try it out, and let me know if you find any quirks or improvements!

labelgen.py – KiCad Net Label Inserter

A lightweight Python utility to insert local or global net labels into a KiCad schematic (.kicad_sch) from a CSV file.

Features

  • Interactive GUI for configuration and file selection (Windows/macOS).
  • Imperial (mil) and Metric (mm) unit support—default is mil.
  • Local or Global net label option via checkbox—default is local.
  • Automatic backup of the schematic (.bak saved alongside original).
  • Uppercases all labels for consistency.
  • Direct file editing using kicad-skip—no external APIs.

Prerequisites

  1. Python 3.7+ on your PATH.
  2. pip (comes with most Python installs).
  3. tkinter (standard library GUI toolkit).
  4. kicad-skip (auto‑installed if missing).

Installation

  1. Place labelgen.py in a folder outside your KiCad project root.

  2. (Optional) Make it executable:

    chmod +x labelgen.py
    

Usage

  1. Run the script:

    python labelgen.py
    
  2. A Disclaimer dialog appears:

    • Edits the native .kicad_sch file in place.
    • Creates a backup *.bak next to the original.
    • Recommended to run outside the project root.
    • Labels are placed outside the titleblock at top-left center.
    • Click Yes to continue, No/Close to cancel.
  3. The Settings & Files dialog appears:

    • Defaults: mil units, local labels.
    • Check Use metric units (mm) to switch to millimeters.
    • Check Use global labels for global net labels.
    • Browse and select your .kicad_sch file.
    • Browse and select your .csv file (must contain a Label column).
    • Click OK to start insertion.
  4. After processing, a summary shows how many labels were inserted.


CSV Format

Your CSV must include a header named Label (case-insensitive). All other columns are ignored. Example data:

Pin Number,Pin Name,Label
PB0,PB0,RGMII_RXD2
PB1,PB1,RGMII_RXD3
PB3,PB3,RGMII_RXCTL
PB4,PB4,RGMII_TXD2
PB5,PB5,RGMII_TXD3
PB6,PB6,RGMII_GTXCLK
PB7,PB7,RGMII_GTXEN

Each entry in the Label column is automatically converted to uppercase and inserted as a net label in the schematic. For example, a CSV value of rgmii_rxd2 becomes RGMII_RXD2 in the schematic.


Contributing

Contributions welcome! To contribute:

  1. Fork this repository.
  2. Create a branch: git checkout -b feature/YourFeature.
  3. Implement your changes and commit: git commit -m "Add feature X".
  4. Push to your fork: git push origin feature/YourFeature.
  5. Open a Pull Request describing your enhancement.

Please follow the existing style and update this README for any user-facing changes.


License

This project is licensed under the MIT License. See LICENSE for details.


Changelog

v1.1 (2025‑05‑23)

  • Added global‑label support (checkbox now inserts only global labels when selected).
  • Removed custom X/Y inputs; labels start at –10 mm, –10 mm by default.
  • Default pitch set to 100 mil (imperial) or 2 mm (metric). Pitch remains editable.
  • File‑path fields now show selected schematic/CSV immediately.
  • README updated with clarified defaults and CSV example.

v1.0 (2025‑02‑05)

  • Initial public release with local net‑label insertion from CSV.

Generated by Prism Enterprise LLC

1 Like

PixPin_2025-05-24_11-59-51

The Pin helpers mentioned by Hayden are a nice (relatively new) addition to KiCad. Placing one label with a number at the end, and then pressing the [Ins] key ads a new label with an incremented number.

Another trick for entering many label names manually is to first add a whole column of random named labels with the [Ins] key. then place the mouse cursor over the top one, press e to edit it and hit enter. Then two times the down arrow and press e again to edit the next label. So you don’t need to take your hands of the keyboard or touch the mouse.

It would be hard to do it quicker or easier with some script, unless it’s a very smart script that works with for example FPGA synthesis tools to automate more.

To keep with your example, you can also place a first label, and from the label entry box copy the RGMII_ part to the clipboard. Then finish the name and place the label. For following labels you can paste the partial name into the name for the new label.

Yet another label speedup: if you first place the mouse cursor over an already labeled wire and press l to start a label, it automatically adds a label with the same name. (You can also hover over a label and press [Ctrl + D] to duplicate it.

Hi Paul
thanks again for all the fantastic tips!
The Ins-key trick and Ctrl +D duplicate are perfect when you’ve got just a handful of nets or they all follow the same pattern. And pasting that common prefix is a real time-saver too.

That said, when you’re staring down 200+ unique net names—especially ones you’ve pulled from an OCR’d PDF or an FPGA toolchain export—it can still be a time killer. That’s where my script comes in. Here’s what I did just as an example

  1. Extract pin map
    I opened up an old KiCad design and grabbed the pin map i created with all the planned mapped functions.

  2. Use ChatGPT to CSV
    Pasted in the pin list and asked ChatGPT to format it as a CSV with a single Label column. Five seconds later I had a clean file.

  3. Run labelgen.py
    Fired up the script, clicked through the disclaimer and settings dialogs (mil vs. mm, local vs. global, CSV file path), and hit OK.

  4. 207 labels dropped
    In under five minutes—including the time to install any missing dependencies and snap a screenshot—the script placed 207 perfectly uppercased net labels at the top-left of the sheet.

  5. Screenshot proof
    I even took a quick screenshot of the CSV file and the resulting schematic page so you can see how it all automates in one shot.

So yes, keep those Ins-key and Ctrl +D hacks for quick edits, but for a big, custom net-naming job, bulk import via CSV really can’t be beat. It’s saved me hours of repetitive typing, and I hope it helps streamline your workflows too!

I made it public because I couldn’t find anything else that did exactly this. If it saves someone some time or proves helpful—that’s fantastic. And if nobody ever uses it, that’s okay too!





Screenshot 2025-05-23 222740

If you’re generating that many labels, then more automation is a plus.
This also reminds me of uConfig.

Another useful utility may be SKiDL. SKiDL is quite a weird duck. It completly bypasses the schematic. It’s a Python library for directly generating the output to create a PCB. It may be great for big LED arrays (two nested loops in SKiDL) or to interface with FPGA tools. With FPGA tools, classic schematics do not make much sense. You just get big schematic symbols with rows of pins connected to labels.

And there are probably over 100 side projects around KiCad. The biggest problem I see is that most tend to be written, then maintained for a few years and then the creator moves on and it’s not maintained and adjusted for newer KiCad versions.

1 Like

bulk net label in Ai
Bulk-generate net labels with the AI of Kicad-huaqiu - Schematic - KiCad.info Forums

1 Like