Skip to main content

Parser and query API for bank CSV account transactions

Project description


.. image::
:alt: Wheel Status

Elv is a small module for parsing bank transactions from CSV files and
performing queries on the data.

It currently only supports one bank, Jæren Sparebank, but I'll add support for
other banks whenever I get an example dump of their format. Send pull requests
if you have them at ``__.


* Parses CSV file from bank containing transactions

* Money is stored in exact decimals

* Contains a simple Python query API for sorting through large collections of

* Can optionally put transactions in an in-memory SQLite3 database for even
better queries.

Elevator pitch
>>> import elv
>>> trans = elv.parse("export.csv")
>>> trans
<Transactions:400 items from 2009-01-27 to 2014-09-29>
>>> trans[0].amount

Norwegian short description

Elv er en Python modul for å lese banktransaksjoner eksportert fra
banken din som en CSV-fil. Foreløpig er det kun Jæren Sparebank som jeg
*vet* er støttet, men du kan nok ganske enkelt legge til lesere for
andre format. Send meg gjerne eksempler på andre format!

Instructions for Jæren Sparebank

Use the "export data" feature in the online bank, and you should be able
to parse the file using Elv. I've seen other online banks having similar
features, so please send me examples of other formats and I'll add them.


You can install from ````::

$ python install # you may have to run as sudo

or from PyPI::

$ pip install elv

Example usage

If you have the bank account transactions in a file called ``data.csv``, you
can simply do::

$ python
>>> import elv
>>> transactions = elv.parse("data.csv")
>>> transactions
<Transactions:400 items from 2009-01-27 to 2014-09-29>
>>> transactions[0]
<Transaction:2014-09-29 2014-09-29 -2677.00 29519.13 'Vacation'>
>>> transactions[0].xfer, 9, 29)
>>> transactions[0].posted, 9, 29)
>>> transactions[0].amount

You can also get an in-memory SQLite3 database by doing::

>>> db = transactions.to_sqlite3()
>>> db
<sqlite3.Connection object at 0x10f31e200>
>>> db.execute("SELECT * FROM Transactions").next()
(0,, 9, 29),, 9, 29),
u'Vacation', Decimal('-2677'), Decimal('29519.13'))

The CSV File Format

The CSV file should be a plain text file with the
`ISO-8859-1 <>`__ encoding
(aka Latin1). It looks like this:


"31-12-2014";"31-12-2014";"Test 1";"-497,78";"5.520,09"
"30-12-2014";"31-12-2014";"Test 2";"-100,00";"6.017,87"
"30-12-2014";"31-12-2014";"Test 3 --æøåÆØÅ--";"-145,47";"6.117,87"
"30-12-2014";"30-12-2014";"Test 4";"-457,24";"6.263,34"
"29-12-2014";"29-12-2014";"Test 5";"-108,30";"6.720,58"

The fields are as follows:

- Date when the transaction was placed, in format ``"DD-MM-YYYY"``.
- Date when the transaction was posted ("bokført").
- A message associated with the transaction, set by the one making the
- The amount deposited or deducted from the account in `NOK (Norwegian
kroner) <>`__ in format
``"-123,45"``, always two decimals and an optional sign.
- The balance of your account after this transaction was completed.

The file itself contains no headers, and can contain many such
transactions, one per line.


Copyright (C) 2015 Christian Stigen Larsen

Licensed under AGPL v3 or later; see

Project details

Download files

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

Files for elv, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size elv-1.0.4-py2.py3-none-any.whl (8.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size elv-1.0.4.tar.gz (20.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page