Table of Contents

1. Configuring acst2qif

Acst2qif is a converter of bank account statements from PDF to the QIF format. As the formats of these PDF bank account statements differ from bank to bank, the user needs to configure acst2qif so it understands the format of his bank.

Typical usage:

  1. Get account statement from your bank as PDF file.
  2. Put it in the directory specified in the account's section of the configuration file; ordered chronologically.
  3. Run without arguments so it uses the ~/.acst2qif.cfg config file. It produces output in the output file specified in [General] section.

The output file then contains data from the newest PDF input file in each directory. It should be possible to import the file with any finance manager that understands QIF. However, it has only been tested with KMyMoney. If you use KMyMoney, then import the output file in KMyMoney and check each account in KMyMoney against the original PDF account statement:

  • If you missed an account statement, there will be a difference between KMyMoney and the statement's balance.
  • If you import an account statement twice, KMyMoney will most likely report it.


  • Widely configfile-driven for automated batch run, but also individual options.
  • Create one QIF file for several accounts, so only one import is needed.
  • Configurable per single account and per account type.

Not implemented:

  • Balance statements. According to Thomas Baumgart 2010-06-14, support in KMyMoney for these elements is not implemented in QIF, only in a OFX version. So it makes no sense for me personally to implement it in acst2qif.
  • Remembering already processed files.
  • Investment accounts. This is planned for the future.

As acst2qif does not remember already processed PDF files, it can happen that such a file is imported twice. The financial software should detect double imports and warn. KMyMoney does.

Acst2qif needs a configuration file by default in ~/.acst2qif.cfg; other locations can be given as an option.


show program's version number and exit
-h, --help
show this help message and exit
-v, --verbose
be verbose
-i INPUT, --input=INPUT
specify input file (list)
-o OUTPUT, --output=OUTPUT
specify output file
-a ACCOUNT, --account=ACCOUNT
specify account (list)
specify configuration file, default ~/.acst2qif.cfg

There is no man page for acst2qif, only the help message and some documentation in Unibas.

1. Configuring acst2qif

The configuration file has several sections. Each begins with a name in brackets ([]). An example configuration file with comments is provided. Adapt it to your situation according to these comments.

In [General], list accounts and a default outfile. Then prepare each account type, especially regular expressions, and prepare each single account, e.g. dir where balances are kept, categoryDic etc.

The [General] section contains a list of sections of accounts to process automatically. (These section names may be different from the corresponding account names). Unless you specify an input file list with the -i/--input option, input files are automatically specified as follows:

Loop over this accounts list
                for each account, lookup its directory (dir entry)
                    from this directory, sort files alphabetically and take the last one

If the alphabetical order corresponds to the temporal order (e.g. use ISO date format 2010-12-31 or 2010q4 for 4th quarter of 2010), then this always gives the latest file of that directory.

With "accounts" you specify the account sections.

With "outfile" you specify the default path to the .qif file to generate. You can specify a different path with the -o/--output option.

Configuring accounts: Each account section contains some keywords. One of them can be "type". With "type" you specify the name of an account type section, which contains further configurations for all accounts of the same type.

With "name" you specify the name of the account as used in the financial software.

With "qif_account_type" you specify the QIF account type according to the QIF documentation, for example an asset account is "otha" in QIF.

With "dir" you specify the directory where the PDF statements of this account are stored. The last file will be taken from this directory.

The "categoryDic" maps PDF statement category names to category names as your financial software knows them. Some categoryDic entries come from the individual account, some from the account type. A "categoryDic" specifies a Python dictionary where the keys are (Python) regular expressions and the values are strings. The regular expressions should match the PDF statement category names. For the first regular expression that matches, the corresponding string is taken. Account names (in contrast to categories) may have to be enclosed in []

Configuring account types: With "ihead_regexp" you specify a regexp for detecting the item head, with transaction date (parts: day, month, year), detail text, and amount. Example:

            ihead_regexp: ^ [d.]{10} +(?P<day>dd).(?P<month>dd).(?P<year>d{4}) +(?P<detail>.{57})  +(?P<amount>.*)$

With "iadd_regexp" you specify a regexp for detecting additional item text (2nd and following lines of a transaction) Example:

            iadd_regexp: ^ {75}(?P<detail>.*)$

With "credit_regexp" you specify a regexp for credit amount (positive). Example:

            ^ *(?P<int>[d.]+),(?P<frac>dd) H.*$

With "debit_regexp" you specify a regexp for debit amount (negative); may be the same as for credit amount. Example:

            debit_regexp: ^ *(?P<int>[d.]+),(?P<frac>dd) S.*$

Note that statements for the same account can come in different formats depending on whether it's a regular monthly/quarterly statement or a statement generated on demand and printed to PDF file. Ideally the converter understands both (with carefully chosen regexps). Depending on the bank, years can be 2 or 4 digits long. Note that empty space length varies. After the amount, a running balance can follow or not (if it does, it is ignored, as it cannot be imported).