CSV Import (MasterCard)

From GnuCash
Jump to: navigation, search

General CSV import/export issues are addressed in a separate wiki page.

Import MasterCard Transactions

I could import from every bank account, but couldn't from my MasterCard account, because GnuCash does not support CSV import.

Importing from CSV is difficult, because CSV does not contain all informations GnuCash needs, and every CSV file is different from the other.

So I wrote a cvs2ofx converter for my MasterCard. It can handle CSV files, downloaded via the https://umsatzabfrage.mastercard.at/Umsatzabfrage/ portal.


1. Simply download mastercard2ofx:

 wget http://members.inode.at/martin.klaffenboeck/scripts/mastercard2ofx

Remark This address appears to be broken (404). Hopefully the source still exists somewhere else.

2. Download your CSV file from 'Umsatzabfrage' or maybe an English one. 'Umsatzabfrage' is something like 'request for transactions'. Its important to name your CSV file with the number of your credit card. The CSV file does not contain this inside, and the script takes it from the name. So your save as file name looks like:


3. Convert the CSV file (the outfile can have any name, because the card number is saved inside:

 ./mastercard2ofx 1234567812345678.csv outfile.ofx

Now you can import this file via GnuCash's OFX import.

Adjusting mastercard2ofx

If you want to support your CSV file, and this script doesn't handle it, it is easy for any python programmer to change it. Just look inside the file, there is a class called 'csv' with a method called 'next'. The next method reads the next line of the CSV file, the 'rawval' is the raw valued list of the CSV file. So it can be indexed with the number of the position in the CSV file you have for your data (starting with 0).

- Martin <martin.klaffenboeck@gmx.at>

Other banks

http://iki.fi/lindi/darcs/gnucash/sampo2ofx is a slightly modified version that can read www.sampopankki.fi CSV format.

- Timo Lindfors <timo.lindfors@iki.fi>