KiBOM and xlsx files

Hello,

I’m using the excellent KiBOM plugin from @SchrodingersGat
I can generate .csv and .xml files.

Unfortunately I can’t with the .xlsx extension. I receive these messages:

Saving BOM File: C:\Users\pcu\Documents\A23_A\testxx_bom_A_(udefault).xlsx
ERROR Error writing XLSX output
ERROR Error writing variant ‘udefault’

xlsxwriter module is installed and works because I can create the HelloWorld.xlsx example.
I’m on windows 10.

I tried on different directories to avoid access privilege but nothing to do.

Thank you for your help.

I am unfamiliar with Plugins (other than my electric appliances) as well as KiBOM or Kaboom for that matter. But it is not difficult to import a .csv text file into Excel. Is this a workable solution?

Yes @BobZ you are right. But if I can skip one step in import it could be better.
And it is probably a little detail that doesn’t work…

Pierre

Same here - just tried out KiBOM and it’s fantastic!

However, XLSX export does not work, Command error. Return code -1

@BobZ: Yes you can import it in Excel. However, there are a lot of manual steps and you really need to be careful with the import format. Excel might replace a part number of 693071010801 to 6.9307E+11 or even worse convert Molex connector part numbers like 20-05-2020 into the date format. You can prevent this from happening by manually selecting text format, but this is extremely error-prone and for that reason, I’d like to be able to export the BOM without any additional manual steps.

Have you tried “.xls” as the export suffix? I’m not in front of my computer right now to check this.

Libreoffice CALC seem much more predictable when it comes to CSV import, compared to EXCEL. Indeed importing CSVs into Excel is PITA.

“.xls” gives me a csv output.

@p_culot can you try running the script with verbose output, to see some more information about the error (if there is information available)?

Try adding -vvvv to the command

I do not use the .xslx export much (or at all) so there’s a chance there’s a bug that has slipped through.

Another way is to use the LibreOffice command line utilities to convert the CSV to an XLSX.
Something like this:
soffice --convert-to xlsx --headless --infilter="CSV:44,34,76,1,4/2/6/2" bom.csv
For the import format (--infilter) see here: https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options In my example the 44 means use comma (ASCII value 44 or 0x2C) as a field separator, the 34 means text is inside " (ASCII value 34 or 0x22), 76 says the import encoding is UTF8, the 1 means start at line 1 and the 4/2/6/2 means read the column 4 and 6 as text (Text has number 2).

I didn’t test this with an actual BOM since i don’t know how your CSV BOM looks like, so you may need to change the import filter. The most important thing is probably to to define all needed text columns as text so no unexpected conversion to a number or date happens.

Place that inside a script, whatever the .sh equivalent on Windows 10 is, run it every time you create a new BOM to create the .xlsx file.

I tried with verbose flag, but not more information.

However, the initial cmd python “H:\Program Files\KiCad\bin\scripting\plugins\KiBoM-master\KiBOM_CLI.py” “%I” “%O.xlsx” creates a XML file.

After that and outside of Kicad, the command python :
python “H:\Program Files\KiCad\bin\scripting\plugins\KiBoM-master\KiBOM_CLI.py” “S:_CplusC_PRJ\A23-[]Simple_version\SCH_PCB\A23_A\A23_A.xml” “S:/_CplusC/_PRJ/A23-[]Simple_version/SCH_PCB/A23_A/A23_A.xlsx”

creates a correct .XLSX file…
Inside Kicad, no file is generated.

Pierre