Exporting customer and vendor data

Rick Copple rick at copplecleaningservice.com
Wed Jan 31 04:44:49 EST 2018


I checked out the pycash python script for get_customers_from_xml.py as 
a way of exporting in csv format from the XML file. I believe I've 
figured out how to make this work.

It involves going to <https://github.com/EvansMike/pycash> to download 
that script. Then, make a copy of your gnucash file. Then rename the 
.gnucash extension to .zip. This is also a good time to rename the whole 
file to something different if you have spaces in your filename.

Then extract the file from it, which will be the XML file. (I couldn't 
get it to go inside to access the file, though there may be a way for it 
to do it.) I also added the .xml onto the file as an extension, though I 
don't know if that is necessary or not.

Then I was able to run the script for extracting customers by going into 
terminal to the location of your xml file and typing in:  python 
<directory to wherever you put your script file and its full file name> 
<name of the xml file> c > <name of a csv file>. So in my case, I had 
"python ~/home/rick/MyScripts/get_customers_from_xml.py CCS.xml c > 
CCSCust.csv"

That exported into the output file a list of customers from the XML file 
which can be imported into your GNUCash file using the "File," "Import," 
"Customers and Vendors". Select the file at the top, select "Customers" 
as your import type, and select "Commas with quotes" as the input format.

The only thing is it exports all your customers, active and inactive, 
and imports them all as active.

As it says on the site, the export of vendors doesn't work yet. I 
figured out why and fixed it by adding two lines of code to it. I'll 
explain further on that point if there is interest in doing so. But I 
was able to export from the old xml file and import both customers and 
vendors into a new file using this procedure.

Hope this is of help to someone.

-- 
Rick Copple



More information about the gnucash-user mailing list