GnuCash Python helper script to import transactions from QIF text files into GnuCash's own file format
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Support MySQL backend Feb 1, 2015
LICENSE Create LICENSE Mar 13, 2017
README.md fix README format Feb 1, 2015
import.py Add support for , as decimal seperator May 22, 2016
qif.py Do not import same entries twice if read from multiple files at once,… Jan 10, 2014

README.md

GnuCash QIF Import

GnuCash Python helper script to import transactions from QIF text files into GnuCash .gnucash file (or into MySQL).

Main use case for myself was automating the import of QIF files generated by GnuCash Mobile Android app into my desktop GnuCash application.

See also my blog post "Synchronizing GnuCash mobile with GnuCash desktop".

Prerequisites

  • Python 2.7+
  • GnuCash 2.4+
  • GnuCash Python Bindings
  • MySQL Server (optional, to store Gnucash data into MySQL)
  • MTP tools (optional, to import from MTP device)

Getting Started

For Ubuntu 13.04, 14.04:

sudo apt-get install gnucash python-gnucash
./import.py -v -f examples/accounts.gnucash examples/expenses.qif

For Ubuntu 13.04, 14.04 (MySQL):

sudo apt-get install gnucash python-gnucash
sudo apt-get install libdbd-mysql
mysql -u $USERNAME -p$PASSWORD -h $HOSTNAME
mysql> create database accounts;
mysql> use accounts;
mysql> source examples/accounts.sql
./import.py -v -f mysql://$USERNAME:$PASSWORD@$HOSTNAME/accounts examples/expenses.qif

The above command should log two "Adding transaction for account.." lines and will add the expenses from examples/expenses.qif to the accounts.gnucash file. Open accounts.gnucash (or the equivalent database in case of MySQL) with GnuCash before and after executing the above command line to see the difference.

The Python script will assume "EUR" as default currency (QIF files do not specify any currency). Use the --currency command line flag to change this.

How to import from MTP device (Android phone)

The import.py script also supports directly importing QIF files from devices supporting MTP, e.g. Android phones. This is handy if you use GnuCash Mobile and want to synchronize (importing previously saved QIF files) when connecting your phone via USB. You need the "mtp-tools" command line programs to use this feature:

sudo apt-get install mtp-tools

To import all files ending with ".qif" from your MTP device (connected via USB) into your "my-accounts" GnuCash file:

./import.py -v -f ~/my-accounts.gnucash mtp:.*.qif

You can use the --dry-run option to do a safe trial run. In order to be able to safely repeat the above command without getting a bunch of duplicate transactions (and to speed up the stupidly slow MTP access), the import.py script remembers the imported file names in ~/.gnucash-qif-import-cache.json.