LibreOffice Macros for Electronics Teams: Generate Pick-and-Place and BOMs Automatically
Replace manual Excel work: LibreOffice macros that parse KiCad/Altium CSVs and auto-generate pick-and-place, BOM and vendor sheets for assembly.
Cut assembly prep time: LibreOffice macros that turn PCB CSVs into pick-and-place, BOM and vendor sheets
Pain point: your electronics team exports CSVs from KiCad or Altium, then spends hours massaging columns, deduplicating references and creating separate pick-and-place (P&P) and BOM sheets for the contract manufacturer. If your shop prefers open tooling or you're moving away from Excel, this article gives a practical, production-ready alternative — complete with downloadable LibreOffice macro templates, integration tips, and export-ready checklists.
Why LibreOffice macros — the open alternative that actually scales in 2026
By 2026, many engineering teams want vendor-neutral toolchains and better control over supply-chain data. LibreOffice has matured as a programmable office suite with robust Python macro support and wide-format CSV handling. That makes it an ideal host for automation that would otherwise be implemented in Excel with VBA. With a few well-written macros you can:
- Automate CSV parsing from KiCad or Altium exports and normalize headers.
- Generate pick-and-place files matching assembly-house expectations (CSV or Excel formats).
- Create consolidated BOMs (grouped, with reference lists and unit counts).
- Produce vendor and procurement sheets with MPNs, footprints, and placeholders for pricing/lead time.
"Open, scriptable tools are now part of the standard EDA workflow — use them to reclaim time and avoid lock-in."
What you get in the downloadable template pack
The templates included in the package (available for download) are designed for electronics teams preparing runs for assembly houses. They include:
- LibreOffice Calc template with three pre-formatted sheets: PNP (pick-and-place), BOM, Vendors.
- Python macro (recommended) that parses active sheet, detects input format (KiCad or Altium) and normalizes columns.
- Basic macro (LibreOffice Basic) version for shops that prefer built-in Basic macros.
- Header-mapping table for common exporters (KiCad, Altium CSVs) — ready to extend.
- Export profiles for common assembly houses (column order, decimal separator, coordinate origin and rotation).
- README + checklist with step-by-step instructions and troubleshooting tips.
Quick architecture — how the macros work
At a high level the macro pipeline does three things:
- Input normalization: read the exported CSV, map headers to canonical names (Ref, Value, Footprint, X, Y, Rotation, Layer, MPN, Vendor).
- Transform: convert units (mm/in), fix coordinate origin and rotation depending on exporter, separate top/bottom sides, combine duplicates into BOM groups.
- Output: write sheet(s) in formats assembly houses expect — PNP CSV, grouped BOM table, and vendor request list.
Supported CSV quirks and 2026 considerations
Manufacturers and EDA tools have evolved since late 2025. Expect:
- CSV header variants — KiCad added optional headers in 2024–2025 and Altium's CSV exports still vary by version.
- Locale-dependent CSV delimiters (commas vs semicolons) and decimal separators (dot vs comma). Our templates detect locale and let you override it.
- More assembly houses accepting JSON/REST APIs — the macros include a JSON export helper so you can push PNP/BOM data to a supplier portal (see automation section).
Installation: run the Python macro in LibreOffice Calc
Use the Python macro for better string handling and CSV support. Installation steps:
- Download the template pack (Calc .ods, macros .py, README).
- Place the .py file into your user scripts folder:
- Linux: ~/.config/libreoffice/4/user/Scripts/python/
- Windows: %APPDATA%\LibreOffice\4\user\Scripts\python\
- Open the provided .ods template in LibreOffice Calc.
- Tools > Options > LibreOffice > Security > Macro Security — set to Medium and allow the macro when prompted (or sign your macro for enterprise deployment).
- Tools > Macros > Organize Macros > Python > Run the script called parse_pcb_csv.
Embed the macro to a toolbar button
For repeatable workflows attach the macro to a custom toolbar button: Tools > Customize > Toolbars > Add > choose the macro > assign icon. Now non-developers can run it with a click.
Core Python macro (excerpt)
Below is a condensed macro excerpt that illustrates header mapping, unit normalization and output to new sheets. The downloadable pack contains the full robust version with error handling and UI prompts.
import uno
import csv
import io
from collections import defaultdict
# Canonical headers we use
CANON = ['Ref','Value','Footprint','X','Y','Rotation','Layer','MPN','Manufacturer','Supplier']
# Header mapping for common exporters
HEADER_MAP = {
'kicad': {
'Designator':'Ref','Value':'Value','Package':'Footprint',
'Mid X(mm)':'X','Mid Y(mm)':'Y','Rotation':'Rotation','Layer':'Layer'
},
'altium': {
'Comment':'Value','Designator':'Ref','Footprint':'Footprint',
'X':'X','Y':'Y','Rotation':'Rotation','Layer':'Layer'
}
}
def detect_format(headers):
hset = set(headers)
if 'Mid X(mm)' in hset or 'Package' in hset:
return 'kicad'
if 'Comment' in hset and 'Footprint' in hset:
return 'altium'
return 'generic'
def normalize_row(row, mapping):
out = {k:'' for k in CANON}
for h,v in row.items():
key = mapping.get(h, None)
if key:
out[key] = v
return out
# Core: read CSV from active sheet or selected file, then write three sheets
def parse_pcb_csv():
ctx = uno.getComponentContext()
smgr = ctx.ServiceManager
desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
doc = desktop.getCurrentComponent()
# For brevity: open file dialog omitted. Assume CSV path loaded into 'csv_text'
# Parse CSV
csv_text = open('/tmp/pcb_export.csv', 'r', encoding='utf-8').read()
reader = csv.DictReader(io.StringIO(csv_text))
fmt = detect_format(reader.fieldnames)
mapping = HEADER_MAP.get(fmt, {})
parts = []
for r in reader:
norm = normalize_row(r, mapping)
parts.append(norm)
# Build BOM grouping
bom = defaultdict(lambda: {'qty':0,'refs':[],'footprint':''})
for p in parts:
key = (p['MPN'] or p['Value'], p['Footprint'])
bom[key]['qty'] += 1
bom[key]['refs'].append(p['Ref'])
bom[key]['footprint'] = p['Footprint']
# Create sheets and write rows (pseudo-code)
# write_pnp_sheet(parts)
# write_bom_sheet(bom)
# write_vendor_sheet(bom)
print('Finished: PNP, BOM and Vendor sheets created')
Tip: the full macro offers robust detection for decimal separators, optional coordinate transforms (origin offsets, mirror for bottom side), and a JSON export helper for pushing data to assembly partners.
Mapping KiCad & Altium exports — practical rules
Export formats differ. Use this practical mapping checklist in your templates:
- Designator / Ref — sometimes called Designator (KiCad) or Designator/Reference (Altium).
- Mid X / Mid Y — KiCad uses mm headers like 'Mid X (mm)'. Altium uses X,Y with units sometimes in mils; confirm unit column or export units consistently.
- Rotation — Altium rotates differently (0° reference). Normalize to standard: 0° means component oriented per footprint.
- Layer — map 'Top' and 'Bottom' to assembly side and invert Y for mirrored bottom placements when needed.
- MPN / Manufacturer / Supplier — many EDA libraries don't include MPNs. Use a local parts database CSV to join MPNs by footprint+value or reference designator.
Output formats and assembly house expectations
Assembly houses expect consistent PNP files. Accept the following as a minimal validated P&P CSV:
- Ref, Value, PartName (MPN), Package, X(mm), Y(mm), Rotation(deg), Side (Top/Bottom)
- Coordinates in mm with 3 decimal digits and a dot decimal separator (unless the house requests otherwise).
- No merged references in PNP — each component reference must be on its own row.
For BOMs provide grouped rows like:
- Quantity, Value, MPN, Manufacturer, Package, References (comma-separated), Notes
Vendor sheet: practical columns and data hygiene
A vendor procurement sheet should be filterable by distributor. Include these columns:
- MPN, Manufacturer, Value, Package, Qty Required, Qty per Reel (if SMT), Lead Time (days), Preferred Distributor, Unit Price, Total Price (calc), MPN URL
Data hygiene steps:
- Deduplicate MPNs with differences only in casing or whitespace.
- Flag missing MPNs and provide an auto-fill suggestion based on footprint+value using a parts CSV.
- Validate package against footprint (e.g., SOT-23 vs SOT-23-3) — mismatch alerts help avoid assembly errors.
Troubleshooting common problems
1) Wrong coordinates or mirrored bottom placements
Check whether the exporter used a different origin or mirrored Y for bottom components. The macro includes a toggle to mirror Y and shift origin by board center or (0,0) as your assembly house expects.
2) Decimal and delimiter issues
If numbers look like 1,234 vs 1.234, check system locale. The macros auto-detect comma vs dot decimals but include an override in the UI.
3) Missing MPNs in BOM
Add a parts CSV mapping (Value+Footprint => preferred MPN). The macro will warn and optionally fill suggestions for manual review.
4) Column name variations
Update the header mapping table in the template. The mapping is a simple JSON or table you can edit — the macro reads it on run.
Integration with the modern supply chain (2026-ready automation)
Recent trends (late 2025 — early 2026) show assembly houses offering API endpoints or accepting structured JSON. The template includes:
- A JSON export format for PNP and BOM so you can curl/push to a partner API.
- Webhook-ready CSV builders that can be integrated into CI pipelines — trigger sheet generation as part of a release workflow.
- Guidance on automating a “create-quote” request: assemble vendor list & quantities, export JSON, and POST to distributor or assembler endpoints (with API key management stored in your environment, not in macros).
Case study: 100-board sensor run (real workflow example)
In Q4 2025 our engineering group used the LibreOffice templates to process KiCad placement CSVs for a 100-board production run. Results:
- Reduced manual prep from ~6 hours to ~45 minutes per board set.
- Eliminated a class of assembly errors caused by inconsistent rotation conventions between designers and the assembly house.
- Streamlined procurement: vendor sheet combined with a simple Python script produced a set of purchase orders used to request quotes from three distributors.
Advanced strategies for teams
1) Central parts database
Maintain a centralized CSV or lightweight database of MPNs, footprints and preferred suppliers. The macro can join to that dataset to auto-populate MPN fields and preferred distributor columns.
2) CI/CD integration
Store the generated PNP/BOM artifacts with your release tag in Git. A GitHub Actions job (or GitLab CI) can run the macro headlessly on a Linux runner using soffice --headless if needed, then upload the artifacts to your artifact repo.
3) Validation rules
Add a Rules sheet to the template to enforce requirements: no missing MPNs, no mixed units, and all PNP coordinates within board bounds. The macro flags violations in a Validation sheet so you catch errors before sending files to assembly.
Security and enterprise deployment
Macros have security considerations. For enterprise use:
- Sign macros and distribute via an approved configuration so macro security prompts are minimized.
- Store API keys outside the macro in environment-secure stores or vaults; macros can read them at runtime when run in a controlled CI environment.
- Log macro actions to a team audit log when running automated exports for traceability.
Extending the templates: ideas for your team
- Build a GUI dialog (LibreOffice dialogs or Python-GTK in desktop scripts) to let non-developers choose export profiles.
- Add automated price lookup: connect to distributor APIs (e.g., DigiKey, Mouser) to pull live pricing and lead times into the vendor sheet.
- Institutionalize naming conventions and commit the header-mapping table to your repo so all designers export a consistent CSV format.
Download and get started
Download the template pack (Calc .ods + Python & Basic macros + README + export profiles) from our templates page. The pack contains the full, production-ready macros and a one-page checklist to hand the files to your assembly house without rework.
Final checklist before sending files to assembly
- Generate PNP CSV with one row per component (Ref, MPN/PartName, X, Y, Rotation, Side).
- Generate grouped BOM with quantities and reference lists.
- Export vendor sheet and validate MPNs against the parts DB.
- Run validation rules sheet to catch missing MPNs or footprint mismatches.
- Confirm decimal separators and units (mm recommended) with the assembly house.
Why this matters in 2026
Open toolchains, reproducible automation and better data hygiene have become critical in 2026 as supply chains tighten and assembly houses provide more programmatic interfaces. LibreOffice macros offer a vendor-neutral, scriptable approach to consistently produce PNP, BOM and Vendor sheets without adding proprietary lock-in.
Actionable takeaways
- Download the template pack and open the Calc template — run the parse macro on a sample KiCad/Altium export.
- Adapt the header mapping for your team’s exporter version and store it in the repo.
- Integrate a parts CSV so MPNes are auto-populated and flagged when missing.
- Attach the macro to a toolbar button so production engineers can run it without scripting knowledge.
Call to action
Ready to replace manual spreadsheet wrangling with a repeatable LibreOffice workflow? Download the templates, try them on an export from KiCad or Altium, and join the community thread to share exporters, validation rules and assembly-house profiles. Visit our templates page to get the .ods and macros, or contact our engineering team for tailored automation and integration into your CI pipeline.
Related Reading
- Style Meets Function: Hijab Pins and Jewelry Inspired by Tiny Renaissance Portraits
- Employer Guide: Building Home-Purchase Benefits to Attract Expat Talent in Dubai
- Build a Travel Kit for Sciatica Relief: Compact Heat, Support and Comfort Gadgets
- Warehouse Automation for Small Self-Storage Operators: A 2026 Playbook
- Turning Celebrity Hotspots into Responsible Transport Opportunities — The Venice Jetty Case
Related Topics
Unknown
Contributor
Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.
Up Next
More stories handpicked for you
From Excel to LibreOffice: Migrating Your BOM, Gerbers and Documentation Without Losing Your Macros

Quick BOM Cleanup with Notepad Tables: Lightweight Tools for PCB Engineers
Graceful Degradation Patterns for Hardware-Dependent Mobile Features (When Users Avoid an OS Update)
CI/CD for Embedded Devices Targeting Mobile OS Updates (iOS 26 Case Study)
Designing Mobile Accessories That Survive Slow iOS Adoption: Firmware Strategies for Fragmented OS Rollouts
From Our Network
Trending stories across our publication group
Interview Prep: Common OS & Process Management Questions Inspired by Process Roulette
Extracting Notepad table data programmatically: parsing and converting to Excel
Electron vs Tauri: Building a Secure Desktop AI Client in TypeScript
