python parser of gnucash file

Justus Pendleton justus at ryoohki.net
Thu Jan 10 01:23:33 EST 2008


On the off chance anyone else actually cares....

Once upon a time I tried to write some reports in gnucash and was discouraged by
the lack of documentation (I don't mind the scheme aspect of it) and gave up.
Fast forward several happy months of using gnucash and (it being year-end) I
decide I want to figure out how to write some fancier reports about asset
allocations and IRR and whatnot. Anyway, some googling around leads me to
Xaprb's GnuCash to MySQL export script. Despite initially thinking that was what
I wanted I soon realized that my brain is insufficiently SQLized to understand
the included queries much less figure out how to write my own.

A day later I had written a simple wrapper around the GnuCash XML file that
parses it (using ElementTree, included in python 2.5) and presents it as a
series of (hopefully) easy to navigate objects, along with some convenience
methods. I've put up a small web page talking about it online[1] and the
mercurial repository containing the work is also available[2]. I've included a
couple of example reports that I've made in the past day, including a (IMHO)
nifty one that creates an SVG graph of your average monthly expenditure over the
past year in each account versus the actual expenditure over the past month[3].

[1]: http://www.ryoohki.net/gnucash
[2]: http://www.ryoohki.net/hg/gnucash
[3]: http://www.ryoohki.net/hg/gnucash/file/tip/queries/avg-monthly-chart.py



More information about the gnucash-user mailing list