Skip to main content

Tool to convert proprietary bank statement to OFX format, suitable for importing to GnuCash

Project description


0.9.1 (2023-09-16)

  • Make OFX output conform to DTD (#243).

0.9.0 (2023-08-07)

  • New -c (--config) option for convert command, allows to specify the configuration file to use (#235).
  • Print the number of transactions in the output (#236).

0.8.0 (2021-09-06)

  • Support OFX CURRENCY and ORIGCURRENCY in statement lines. This allows plugins to add information about transaction currency to generated OFX statements.
  • Add --pretty flag to convert command to produce nicely intented OFX files.

0.7.1 (2020-09-14)

  • Include PEP-561 marker into source code distribution

0.7.0 (2020-09-13)

  • Drop support for Python 3.4, 3.5, add support for Python 3.8
  • Fixed naive end balance validation (#106)
  • Modernize development environment (use pipenv, mypy, black)

0.6.5 (2020-06-09)

  • Added balance checks and improved generation of unique ids (#100, #104)

0.6.4 (2020-03-04)

  • Fix regression introduced in 0.6.3 - edit-config command stopped working.

0.6.3 (2020-02-13)

  • Fix config editing on Windows

0.6.2 (2020-01-20)

  • Better EDITOR environment variable handling for edit-config command
  • Support Python-3.7
  • API: type of StatementLine.date_user (date when user initiated transaction) will not be a string by default.
  • API: More unique generated transaction ids (when one is not available from the statement file)

0.6.1 (2017-05-07)

  • Fix installation problem on python-3.5 (#55)

0.6.0 (2016-12-02)

  • Support for specifying account information for each parsed satatement line and translate it to BANKACCTTO aggregate in OFX.

  • Command line option to display debugging information (--debug).

  • Fix config file location for appdirs >= 1.3.0

0.5.0 (2013-11-03)

  • Plugins are now registered via setuptools' entry-points mechanism. This allows plugins to live in separate eggs and developed independently of ofxstatement itself. Plugins are registered as 'ofxstatement' entry points (#11).

  • Command line interface changed: ofxstatement now accepts "action" parameter and few actions were added:

    • ofxstatement convert: perform conversion to OFX
    • ofxstatement list-plugins: list available conversion plugins
    • ofxstatement edit-config: launch default editor to edit configuration file
  • ofxstatement convert can be run without any configuration. Plugin name to use is specified using -t TYPE parameter in this case (#12).

  • StatementLine supports more attributes, translated to OFX (#13):

    • refnum - translated to <REFNUM> in OFX.
    • trntype - translated to <TRNTYPE> in OFX.

OFX Statement

.. image:: :target: .. image:: :target: .. image:: :target: .. image:: :target:

Ofxstatement is a tool to convert proprietary bank statements to OFX format, suitable for importing into personal accounting systems like GnuCash. This package provides a command line tool to run: ofxstatement. Run ofxstatement -h for more help. ofxstatement works under Python 3 and is not compatible with Python 2.


Most internet banking systems are capable of exporting account transactions to some sort of computer readable format, but few support standard data formats, like OFX. On the other hand, personal accounting systems such as GnuCash support standard formats only, and will probably never support proprietary statement formats of online banking systems.

To bridge the gap between them, this ofxstatement tool was created.

.. _GnuCash: .. _OFX:

Mode of Operation

The ofxstatement tool is intended to be used in the following workflow:

  1. At the end of each month, use your online banking service to export statements from all of your bank accounts in a format known to ofxstatement.

  2. Run ofxstatement on each exported file to convert it to OFX. Shell scripts or a Makefile may help to automate this routine.

  3. Import the generated OFX file into your personal accounting system.

Installation and Usage

Before using ofxstatement, you have to install a plugin for your bank (or write your own!). Plugins are installed as regular python eggs, with easy_install or pip, for example::

$ pip3 install ofxstatement-lithuanian

Note that ofxstatement itself will be installed automatically this way. After the installation, the ofxstatement utility will be available.

Users of Ubuntu and Debian operating systems can install ofxstatement from official package repositories::

$ apt install ofxstatement ofxstatement-plugins

You can check that ofxstatement is working by running::

$ ofxstatement list-plugins

You should get a list of your installed plugins.

After installation, the usage is simple::

$ ofxstatement convert -t bank_statement.csv statement.ofx

The resulting statement.ofx is then ready to be imported into a personal accounting system.

Development / test

ofxstatemnt uses pipenv_ to manage the development environment and dependencies::

$ pip install pipenv $ git clone<your_account>/ofxstatement.git $ cd ofxstatement $ pipenv sync --dev

.. _pipenv:

And finally run the test suite::

$ pipenv shell $ pytest

When satisfied, you may create a pull request.

Known Plugins

There are several user-developed plugins available:

================================= ============================================ Plugin Description ================================= ============================================ ofxstatement-lithuanian_ Plugins for several banks, operating in Lithuania: Swedbank, Danske and common Lithuanian exchange format - LITAS-ESIS.

ofxstatement-czech_ Plugin for Poštovní spořitelna (maxibps) and banks using GPC format (e.g., FIO banka, module gpc).

ofxstatement-airbankcz_ Plugin for Air Bank a.s. (Czech Republic) ofxstatement-raiffeisencz_ Plugin for Raiffeisenbank a.s. (Czech Republic) ofxstatement-unicreditcz_ Plugin for UniCredit Bank Czech Republic and Slovakia ofxstatement-equabankcz_ Plugin for Equa Bank a.s. (Czech Republic) ofxstatement-cz-komercni_ Komerční banka (Czech Republic) ofxstatement-mbankcz_ mBank S.A. (Czech Republic) ofxstatement-otp_ Plugin for OTP Bank, operating in Hungary ofxstatement-bubbas_ Set of plugins, developed by @bubbas: dkb_cc and lbbamazon.

banking.statements.osuuspankki_ Finnish Osuuspankki bank banking.statements.nordea_ Nordea bank (at least Finnish branch of it) ofxstatement-germany_ Plugin for several german banks (1822direkt and Postbank at the moment) ofxstatement-austrian_ Plugins for several banks, operating in Austria: Easybank, ING-Diba, Livebank, Raiffeisenbank. ofxstatement-postfinance_ Swiss PostFinance (E-Finance Java text based bank/credit statements). ofxstatement-mbank-sk_ ofxstatement-be-belfius_ Belfius (Belgium) ofxstatement-be-keytrade_ KeytradeBank (Belgium) ofxstatement-be-ing_ ING (Belgium) ofxstatement-be-kbc_ KBC (Belgium) ofxstatement-be-argenta_ Argenta (Belgium) ofxstatement-be-crelan_ Crelan (Belgium) ofxstatement-be-triodos_ Belgian Triodos Bank CSV statements ofxstatement-be-newb_ Belgian cooperative bank newB ofxstatement-betterment_ Betterment ( ofxstatement-simple_ Simple (the bank, JSON financial statement format ofxstatement-latvian_ Latvian banks ofxstatement-iso20022_ Support for generic ISO-20022 format ofxstatement-seb_ SEB (Sweden), it parses Export.xlsx for private accounts ofxstatement-ee-seb_ SEB (Estonia), parses proprietary csv file ofxstatement-paypal_ PayPal, it parses *.csv for private accounts ofxstatement-polish_ Support for some Polish banks and financial institutions ofxstatement-russian_ Support for several Russian banks: Avangard, AlfaBank, Tinkoff, SberBank (both debit and csv), VTB. ofxstatement-dab_ DAB Bank (Germany) ofxstatement-consors_ Consorsbank (Germany) ofxstatement-is-arionbanki_ Arion bank in Iceland ofxstatement-de-triodos_ German Triodos Bank CSV statements (also works for GLS Bank) ofxstatement-lansforsakringar_ Länsförsäkringar (Sweden), it parses Kontoutdrag.xls for private accounts ofxstatement-revolut_ Revolut Mastercard ofxstatement-transferwise_ Transferwise CSV ofxstatement-n26_ N26 Bank ofxstatement-sp-freiburg_ Sparkasse Freiburg-Nördlicher Breisgau (Germany) ofxstatement-al_bank_ Arbejdernes Landsbank (Denmark) ofxstatement-fineco_ FinecoBank (Italy) ofxstatement-intesasp_ Intesa San Paolo (xlsx balance file) ofxstatement-de-ing_ Ing Diba Bank (Germany) ofxstatement-us-first-republic_ First Republic Bank (USA) ofxstatement-cd-tmb_ Trust Merchant Bank (DRC) ofxstatement-zm-stanbic_ Stanbic Bank (Zambia) ofxstatement-dutch_ Dutch financial institutes like ICSCards and ING ofxstatement-french_ French financial institutes like BanquePopulaire ofxstatement-mt940_ All financial institutes providing Swift MT940 statements ofxstatement-it-banks_ Widiba and Webank italian banks ofxstatement-chebanca_ CheBanca! Italian bank (xlsx format) ================================= ============================================

.. _ofxstatement-lithuanian: .. _ofxstatement-czech: .. _ofxstatement-airbankcz: .. _ofxstatement-raiffeisencz: .. _ofxstatement-unicreditcz: .. _ofxstatement-equabankcz: .. _ofxstatement-mbankcz: .. _ofxstatement-otp: .. _ofxstatement-bubbas: .. _banking.statements.osuuspankki: .. _banking.statements.nordea: .. _ofxstatement-germany: .. _ofxstatement-austrian: .. _ofxstatement-postfinance: .. _ofxstatement-mbank-sk: .. _ofxstatement-be-belfius: .. _ofxstatement-be-keytrade: .. _ofxstatement-be-ing: .. _ofxstatement-be-kbc: .. _ofxstatement-be-argenta: .. _ofxstatement-be-crelan: .. _ofxstatement-be-newb: .. _ofxstatement-betterment: .. _ofxstatement-simple: .. _ofxstatement-latvian: .. _ofxstatement-iso20022: .. _ofxstatement-seb: .. _ofxstatement-paypal: .. _ofxstatement-polish: .. _ofxstatement-russian: .. _ofxstatement-dab: .. _ofxstatement-consors: .. _ofxstatement-is-arionbanki: .. _ofxstatement-be-triodos: .. _ofxstatement-de-triodos: .. _ofxstatement-lansforsakringar: .. _ofxstatement-revolut: .. _ofxstatement-transferwise: .. _ofxstatement-n26: .. _ofxstatement-sp-freiburg: .. _ofxstatement-al_bank: .. _ofxstatement-fineco: .. _ofxstatement-intesasp: .. _ofxstatement-de-ing: .. _ofxstatement-germany: .. _ofxstatement-us-first-republic: .. _ofxstatement-cz-komercni: .. _ofxstatement-cd-tmb: .. _ofxstatement-zm-stanbic: .. _ofxstatement-dutch: .. _ofxstatement-french: .. _ofxstatement-mt940: .. _ofxstatement-it-banks: .. _ofxstatement-ee-seb: .. _ofxstatement-chebanca: Advanced Configuration

While ofxstatement can be used without any configuration, some plugins may accept additional configuration parameters. These parameters can be specified in a configuration file. The configuration file can be edited using the edit-config command that opens your favorite editor (defined by environment variable EDITOR or else the default for your platform) with the configuration file::

$ ofxstatement edit-config

The configuration file format is in the standard .ini format. The configuration is divided into sections that correspond to the --type command line parameter. Each section must provide a plugin option that points to one of the registered conversion plugins. Other parameters are plugin specific.

A sample configuration file::

plugin = swedbank

plugin = litas-esis
charset = cp1257
currency = USD
account = LT123456789012345678

Such a configuration will let ofxstatement know about two statement file formats handled by the plugins swedbank and litas-esis. The litas-esis plugin will load statements using the cp1257 charset and set a custom currency and account number. This way, GnuCash will automatically associate the generated .ofx file with a particular GnuCash account.

To convert the proprietary CSV file danske.csv into the OFX file danske.ofx, run::

$ ofxstatement -t danske:usd danske.csv danske.ofx

Note that configuration parameters are plugin specific. See the plugin documentation for more info.

To use a custom configuration file, pass the -c / --config option::

$ ofxstatement convert -t pluginname -c /path/to/myconfig.ini input.csv output.ofx

Writing your own Plugin

If the plugin for your bank has not been developed yet (see Known plugins_ section above) you can easily write your own, provided you have some knowledge about the Python programming language. There is an ofxstatement-sample_ plugin project available that provides sample boilerplate and describes the plugin development process in detail.

.. _ofxstatement-sample:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ofxstatement-0.9.1.tar.gz (42.0 kB view hashes)

Uploaded source

Built Distribution

ofxstatement-0.9.1-py3-none-any.whl (40.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page