Skip to content
Pythonic interface to GnuCash SQL documents
Branch: master
Clone or download
Latest commit 173cb21 Apr 29, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
appveyor iterating on appveyor.yml Nov 11, 2015
docs improve docs (from static code to ipython code) + update books examples Apr 28, 2019
examples warn if no filename sent Nov 12, 2017
gnucash_books add book_prices Apr 28, 2019
piecash improve get_balance: Apr 24, 2019
piecash_interpreter - add files to build a piecash executable to run scripts Jan 1, 2015
tests improve get_balance: Apr 24, 2019
.gitattributes minor doc improvement + fix on language detection github Mar 12, 2015
.gitignore - return sessions (wrapped with some more attributes) instead of book… Nov 18, 2014
.readthedocs.yml install piecash with setuptools Apr 28, 2019
.travis.yml remove locale-gen on travis due to error when using xenial dist Apr 15, 2019
CHANGELOG.rst improve get_balance: Apr 24, 2019
DEVELOPER.rst wip releas 1.0.0 Apr 15, 2019
LICENSE initial commit Nov 11, 2014 update to py3 only (tox, CI, appveyor, Apr 25, 2018
Pipfile update to py3 only (tox, CI, appveyor, Apr 25, 2018
Pipfile.lock add pipfile.lock Jun 6, 2018
README.rst wip releas 1.0.0 Apr 15, 2019
appveyor.yml do not install pip on appveyor Apr 15, 2019
bumpr.rc do not use suffix when bumping Nov 1, 2015 add caching to github script to workaround the API rate limiting Oct 8, 2017 fix pavemant after changes in Dec 6, 2015
requirements-dev.txt add piecash direct deps Apr 24, 2019 add 3.7 in Apr 15, 2019
tox.ini update to py3 only (tox, CI, appveyor, Apr 25, 2018



Join the chat at

Piecash provides a simple and pythonic interface to GnuCash files stored in SQL (sqlite3, Postgres and MySQL).


It is a pure python package, tested on python 3.5/3.6, that can be used as an alternative to:

  • the official python bindings (as long as no advanced book modifications and/or engine calculations are needed). This is specially useful on Windows where the official python bindings may be tricky to install or if you want to work with python 3.
  • XML parsing/reading of XML GnuCash files if you prefer python over XML/XLST manipulations.

piecash test suite runs successfully on Windows and Linux on the three supported SQL backends (sqlite3, Postgres and MySQL). piecash has also been successfully run on Android (sqlite3 backend) thanks to Kivy buildozer and python-for-android.

It allows you to:

  • open existing GnuCash documents and access all objects within
  • modify objects or add new objects (accounts, transactions, prices, ...)
  • create new GnuCash documents from scratch

Scripts are also available to:

A simple example of a piecash script:

with open_book("example.gnucash") as book:
    # get default currency of book
    print( book.default_currency )  # ==> Commodity<CURRENCY:EUR>

    # iterating over all splits in all books and print the transaction description:
    for acc in book.accounts:
        for sp in acc.splits:

The project has reached beta stage.


If you want to work with python 2.7/3.4 and books from gnucash 2.6.x series, you can use piecash 0.19.0. Versions of piecash as of 1.0.0 supports python >=3.5 and books from gnucash 3.0.x series.


  1. Always do a backup of your gnucash file/DB before using piecash.
  2. Test first your script by opening your file in readonly mode (which is the default mode)
You can’t perform that action at this time.