KiCad BOM Wizard Plugin with customisable output (Can make HTML and CSV BOM)

Hello everyone, I’m here to share my new KiCad BOM plugin which I think some of you will find useful.

So for the past few weeks I’ve been working on a JavaScript KiCad plugin that will generate BOM based on configurable template files. the Idea behind it is to make it easier for anyone to customise how the BOM is presented as well as allow the user to select the format. I also wanted to have to sort and group the component together so that it can be better presented.

The plugin works by replacing any of the shortcodes that it find on the template files with the associated data and then it combines everything into one file that it writes to. The components are sorted and grouped by component type. The components are also grouped a second time if the part values and fields data are the same.

At the moment, the plugin comes with two default templates that you can use to generate a HTML and/or CSV BOM. but you can always make your our.
Here the HTML version:

My drive to make this plugin came from my company’s need to generate different types of BOM’s based on our client, manufacture or product certifications requirements. For example, I have a ATEX template that will generate a HTML BOM which has a document number, assigned Engineer and manufactures note.

Here the plugin project page which has writting instructions for using and making your own templates:

Here’s the plugin repository:

Here’s the video showing you how to setup and use the plugin:

There’s till more features that I’m planning to add but for the mean time I wanting to get your feedback.

  • Ron

This looks really nice! I’m definitely going to check it out.

Your work looks extremely useful. I have an initial basic / naive question. Why did you choose node.js? Is that part of a requirement when writing kicad plug-ins? Could you have used python?

KiCad’s BOM plugin manager works by executing the parameters you pass it as a process. So you have the freedom to execute any program or scripts you want not just Python.

I chose NodeJs because I’m quite familiar with it and I find it easier for UI developments.
(no Hint on future Contextual electronics videos. ;D)

Drat. I have a challenge getting Kicad’s BoM plugin to recognize node.js on my mac:

execvp(node, /Users/margaret/Documents/Kicad/KiCad_BOM_Wizard/KiCad_BOM_Wizard.js, /Users/margaret/Documents/LettuceBuddyHW/LadyBugHydro/Ladybug LED/Kicad/LadybugLED.xml, /Users/margaret/Documents/LettuceBuddyHW/LadyBugHydro/Ladybug LED/Kicad/LadybugLED.html) failed with error 2!

I’m thinking this is because the Kicad BoM plugin can’t spawn (find?) node - but when i execute in Terminal it is there… has anyone gotten node.js to work on their mac?

Can you paste the Kicad Command line code you are using.

is it:

node "/Users/margaret/Documents/Kicad/KiCad_BOM_Wizard/KiCad_BOM_Wizard.js" "%I" "%O.html"

if it can’t find node you can always do the following:

/usr/local/bin/node "/Users/margaret/Documents/Kicad/KiCad_BOM_Wizard/KiCad_BOM_Wizard.js" "%I" "%O.html"

/usr/local/bin/node is where I think node js it on a mac

Oh = thank you! How not thinking of me not to consider to use the full path. This worked. Although I would think having /usr/local/bin in PATH should work. It is not clear to me how child spawning works w/in the kicad environment. I guess it doesn’t matter. Obviously, providing the full path works.

#Update 0.0.3
Hello Everyone, on this update, I’ve made some internal changes to the plugin which I believe will make it easier to use and hopefully to distribute.


  • You can install kicad_bom_wizard via npm nodejs package manager using this command. npm install -g kicad_bom_wizard

  • If you install the plugin via npm, then you no longer need to pass nodejs and the script locations you can instead simplify KiCad’s terminal command to this.
    kicad_bom_wizard "%I" "%O.html"

  • You have the option of specify the template located in plugin’s root Template directory by directory name instead of the folder path.

kicad_bom_wizard "%I" "%O.html" "HTML"
kicad_bom_wizard "%I" "%O.csv" "CSV"
  • Added jsDoc documentation support.
  • The project code is now using javascript standard style.

special thanks to Eric Hankinson @Kumichou for your code contribution and feedback.


I have tried running sudo npm install -g kicad_bom_wizard but I get the error:

npm http GET
npm http 304
npm http GET
npm http 304
npm http GET
npm http GET
npm http 304
npm http 304
npm http GET
npm http 304
npm ERR! Error: ENOENT, chmod '/usr/local/lib/node_modules/kicad_bom_wizard/KiCad_BOM_Wizard.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <>
npm ERR! or email it to:
npm ERR!     <>

npm ERR! System Linux 3.13.0-37-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "kicad_bom_wizard"
npm ERR! cwd /home/miceuz/Xaltura/tindie
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /usr/local/lib/node_modules/kicad_bom_wizard/KiCad_BOM_Wizard.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/miceuz/Xaltura/tindie/npm-debug.log
npm ERR! not ok code 0

Hi @Miceuz

I have tried running sudo npm install -g kicad_bom_wizard but I get the error:

In some system, the default directory’s permission that npm uses to install global packages is set to root.This unfortunately causes npm to have issues with accessing that directory even if you use sudo it will still try to access the files as your user.

Its an annoying issue with npm. :frowning:

That said, its not normally a good idea to use sudo to install packages as root as this can cause issues with other node modules that dependent on those packages.

The good news is that you have a two options on how to over come this issue.
Here is a link to the official site with writing and video instructions.

Here’s the video instructions of the two options.

  • The first option will get you to change the permission of the directorys that npm uses for global packages from root to your user.

  • The second option (which I prefer doing on my system), is to change the directory that npm uses to somewhere else that isn’t in the root directory and add them on to your system path.


Thanks for the reply, but I still can not get it to work. I have created a local directory and I still get

npm ERR! Error: ENOENT, chmod '/home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/KiCad_BOM_Wizard.js'

This is the log file:

1222 silly lockFile 490e1e88-s-xmlbuilder-node-modules-lodash tar:///home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/node_modules/xml2js/node_modules/xmlbuilder/node_modules/lodash
1223 silly lockFile a148712b-euz-npm-lodash-4-3-0-package-tgz tar:///home/miceuz/.npm/lodash/4.3.0/package.tgz
1224 silly lockFile a148712b-euz-npm-lodash-4-3-0-package-tgz tar:///home/miceuz/.npm/lodash/4.3.0/package.tgz
1225 info preinstall lodash@4.3.0
1226 verbose readDependencies using package.json deps
1227 verbose readDependencies using package.json deps
1228 silly resolved []
1229 verbose about to build /home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/node_modules/xml2js/node_modules/xmlbuilder/node_modules/lodash
1230 info build /home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/node_modules/xml2js/node_modules/xmlbuilder/node_modules/lodash
1231 verbose linkStuff [ true,
1231 verbose linkStuff   '/home/miceuz/.npm-global/lib/node_modules',
1231 verbose linkStuff   false,
1231 verbose linkStuff   '/home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/node_modules/xml2js/node_modules/xmlbuilder/node_modules' ]
1232 info linkStuff lodash@4.3.0
1233 verbose linkBins lodash@4.3.0
1234 verbose linkMans lodash@4.3.0
1235 verbose rebuildBundles lodash@4.3.0
1236 info install lodash@4.3.0
1237 info postinstall lodash@4.3.0
1238 verbose about to build /home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/node_modules/xml2js/node_modules/xmlbuilder
1239 info build /home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/node_modules/xml2js/node_modules/xmlbuilder
1240 verbose linkStuff [ true,
1240 verbose linkStuff   '/home/miceuz/.npm-global/lib/node_modules',
1240 verbose linkStuff   false,
1240 verbose linkStuff   '/home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/node_modules/xml2js/node_modules' ]
1241 info linkStuff xmlbuilder@4.2.1
1242 verbose linkBins xmlbuilder@4.2.1
1243 verbose linkMans xmlbuilder@4.2.1
1244 verbose rebuildBundles xmlbuilder@4.2.1
1245 verbose rebuildBundles [ 'lodash' ]
1246 info install xmlbuilder@4.2.1
1247 info postinstall xmlbuilder@4.2.1
1248 verbose about to build /home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/node_modules/xml2js
1249 info build /home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/node_modules/xml2js
1250 verbose linkStuff [ true,
1250 verbose linkStuff   '/home/miceuz/.npm-global/lib/node_modules',
1250 verbose linkStuff   false,
1250 verbose linkStuff   '/home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/node_modules' ]
1251 info linkStuff xml2js@0.4.16
1252 verbose linkBins xml2js@0.4.16
1253 verbose linkMans xml2js@0.4.16
1254 verbose rebuildBundles xml2js@0.4.16
1255 verbose rebuildBundles [ 'sax', 'xmlbuilder' ]
1256 info install xml2js@0.4.16
1257 info postinstall xml2js@0.4.16
1258 verbose about to build /home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard
1259 info build /home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard
1260 verbose linkStuff [ true,
1260 verbose linkStuff   '/home/miceuz/.npm-global/lib/node_modules',
1260 verbose linkStuff   true,
1260 verbose linkStuff   '/home/miceuz/.npm-global/lib/node_modules' ]
1261 info linkStuff kicad_bom_wizard@0.0.3
1262 verbose linkBins kicad_bom_wizard@0.0.3
1263 verbose link bins [ { kicad_bom_wizard: 'KiCad_BOM_Wizard.js' },
1263 verbose link bins   '/home/miceuz/.npm-global/bin',
1263 verbose link bins   true ]
1264 verbose linkMans kicad_bom_wizard@0.0.3
1265 verbose rebuildBundles kicad_bom_wizard@0.0.3
1266 verbose rebuildBundles [ 'xml2js' ]
1267 info /home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard unbuild
1268 info preuninstall kicad_bom_wizard@0.0.3
1269 info uninstall kicad_bom_wizard@0.0.3
1270 verbose true,/home/miceuz/.npm-global/lib/node_modules,/home/miceuz/.npm-global/lib/node_modules unbuild kicad_bom_wizard@0.0.3
1271 verbose /home/miceuz/.npm-global/bin,[object Object] binRoot
1272 info postuninstall kicad_bom_wizard@0.0.3
1273 error Error: ENOENT, chmod '/home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/KiCad_BOM_Wizard.js'
1274 error If you need help, you may report this log at:
1274 error     <>
1274 error or email it to:
1274 error     <>
1275 error System Linux 3.13.0-37-generic
1276 error command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "kicad_bom_wizard"
1277 error cwd /home/miceuz
1278 error node -v v0.10.25
1279 error npm -v 1.3.10
1280 error path /home/miceuz/.npm-global/lib/node_modules/kicad_bom_wizard/KiCad_BOM_Wizard.js
1281 error code ENOENT
1282 error errno 34
1283 verbose exit [ 34, true ]

Hi @Miceuz just noticed that my kicad_bom_wizard package didn’t include the actual javascript. Sorry I’ve pushed an update which should solve this issue.

On a different note, I’ve noticed that you aren running an out of data version of node and npm. the current version is

Ron@HDE_VB:~$ node -v
Ron@HDE_VB:~$ npm -v

Could you install the latest version. You can do it by using the prebuild binary package. Here’s a link on how to do it via stackoverflow

Here’s that same instruction but update to for today’s current version.

for 64bit linux

# this will remove old version from your system
sudo apt-get remove nodejs node npm

cd ~/

# download the latest version as of 08 feb 2016

# extract the tar file
tar xf node-v4.2.6-linux-x64.tar.xz

# move it to the correct location in your system
sudo cp -rp node-v4.2.6-linux-x64 /usr/local/

# add a symbolic link so node. this will make it easy to update node in the future
sudo ln -s /usr/local/node-v4.2.6-linux-x64/ /usr/local/node

# now we need to add /usr/local/node/bin to our system path. assuming ubuntu without zsh
printf "\nexport PATH=/usr/local/node/bin:\$PATH\n" >> ~/.profile

# You will need to logout and log back in for the system path to start using /usr/local/node/bin
# check if you the new path in your system
echo $PATH

# check node and npm version
node -v
npm -v


I really like the plug in but I still have some questions:

  1. Where can I add/edit the names for the designators. Because I have some custom designators that are of course not supported. (edit: found it in the template.conf file!)
  2. This is a more general question but what is the right command to safe the generated bom file in a folder located in the project folder. i.e. generate BOM.html and safe it into /projectfolder/BOM with “%O.html” I can just safe the file into the root directory of the project.
  3. Some of my designs have SMD pads that are in the schematic but what I don’t need them on the BOM because they are integrated on the board/design. Is there a way to hide specific parts in the BOM?

Best Regards, Suckiden

to 3) footprint attribute property should be set to ‘virtual’ I think.
usually it’s set to ‘normal’ = through hole (doesn’t appear in position file) and the other one is ‘normal+insert’ = smd (appears in position file)

Where can I add/edit the names for the designators. Because I have some custom designators that are of course not supported. (edit: found it in the template.conf file!)

Awesome. But Just in case anyone else wanted to know.
The file that you will need to edit in order to add your own designators name is the template file Template/HTML/template.conf

The plugin will generate class names for every unique designator that its finds and the format of the name is group_{ designator} where {designator} is the component prefix. For example, capacitor designator is C. So the class name will be group_C. note, the designator is case sensitive, so you will need to make sure that it matches that of your projects.

To add a new designator to the HTML template you will need add the CSS code that will set the group_ class content to the Name you want.

To see an example, you can go to line 85 in Template/HTML/template.conf which has the code for the capacitor.


I would recommend that you modify a copy of the HTML template just in case you are planning on updating the plugin.

This is a more general question but what is the right command to safe the generated bom file in a folder located in the project folder. i.e. generate BOM.html and safe it into /projectfolder/BOM with “%O.html” I can just safe the file into the root directory of the project.

Good question. :smiley:
So I’ve been looking at the KiCad source code and it turns out that the KiCad pluging manager has some extra parameter that we can pass to achieve exactly what you want. on teh command line we can use %P to get the project root path and %B to get the project name.

So for you where you want a BOM directory, the command would look like this.

kicad_bom_wizard "%I" "%P/BOM/%B.html"

Just in case anyone else wanted to know, the KiCad source file I found the parameter is netlist_exporter.cpp line 53

Here’s the code snip:

// Expand format symbols in the command line:
// %B => base filename of selected output file, minus path and extension.
// %P => project directory name, without trailing '/' or '\'.
// %I => full filename of the input file (the intermediate net file).
// %O => complete filename and path (but without extension) of the user chosen output file.

@Joan_Sparky where exactly can I find this option. In the schematic editor or in the PCBnew editor? I looked into both but couldn’t find this option.

@Opticalworm thanks you for your reply, I am already very happy with the script :slight_smile: the only feature I would like to have in the future is an assist that helps you when you manually place components. There is already a pretty interesting script out there that highlights all components of a kind and creates different images I know that your script and this one is pretty different, but a combination of both of them would be very handy.

Don’t hit me for this suggestion but I am just thinking out loud:
What if you could generate a HTML side pretty much like your BOM side but separated into two columns, on the left is the BOM list and on the right are the corresponding images to your selection in the BOM. So if I select the row with the 100nF capacitors on the left the correct image where all capacitors on the board are highlighted is showed on the right.

let me know what you think about this!


1 Like

That’s a footprint properties element… so in the footprint editor - in your nomenclature ‘PCBnew editor’.

Thanks for that link, looks neat. Similar to the other documentation for assembly pdf generator someone else posted here some time ago.

from here:

I am having trouble running the script, I instaled on a fresh VM with Ubuntu 14.04, latest node.js v4.4.1 and installed kicad_bom_wizard via npm.

This is the bom generated from kicad, in cade you need:

I allways tet this erro, please heler:
$ kicad_bom_wizard Cvt4.xml Cvt4-BOMw.csv CSV
KiCad_BOM_Wizard Rev: 0.0.2
reading KiCad XML file [ Cvt4.xml ]
Reading Template [ /usr/local/lib/node_modules/kicad_bom_wizard/Template/CSV ]
Generating BOM [ Cvt4-BOMw.csv ]
Template = Template.replace(//g,[0].sheet[0].title_block[0].title)

TypeError: Cannot read property ‘0’ of undefined
at GenerateBOM (/usr/local/lib/node_modules/kicad_bom_wizard/KiCad_BOM_Wizard.js:369:91)
at Task (/usr/local/lib/node_modules/kicad_bom_wizard/KiCad_BOM_Wizard.js:600:7)
at /usr/local/lib/node_modules/kicad_bom_wizard/KiCad_BOM_Wizard.js:512:7
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)

Hi Alainm, Sorry for the delay it was bank holiday here in the UK.

The google drive link you posted is asking me to request access. Would you be able to post an open link to the file or possible paste the xml file in here.

  • Ron

That’s really cool and useful and even puts my custom tags in there (I put the part number and a distributor part code on everything in the schematic).

Only thing is, I can’t get eeschema to run it, however if I paste the command line it works fine. This is on OSX, I used the npm installer to install it.

Run command:
kicad_bom_wizard “/Users/rols/KiCad/Remote/remote.xml” “/Users/rols/KiCad/Remote/remote.html”

Command error. Return code -1

Error messages:
execvp(kicad_bom_wizard, /Users/rols/KiCad/Remote/remote.xml, /Users/rols/KiCad/Remote/remote.html) failed with error 2!

but from the command line

$ kicad_bom_wizard “/Users/rols/KiCad/Remote/remote.xml” “/Users/rols/KiCad/Remote/remote.html”
KiCad_BOM_Wizard Rev: 0.0.2
reading KiCad XML file [ /Users/rols/KiCad/Remote/remote.xml ]
Reading Template [ /usr/local/lib/node_modules/kicad_bom_wizard/Template/HTML ]
Generating BOM [ /Users/rols/KiCad/Remote/remote.html ]
BOM created

I tried explicit paths and a few other things but started to make more mess than progress. Any ideas?