All My Brain Where stuff from my brain lands

February 4, 2009

Converting financial CSV data to OFX or QIF import files

Filed under: Software — Tags: , , , , , , — Dennis @ 8:27 am

As a side project, I created a CSV to OFX converter that applies custom mappings to CSV data to export them to QIF or OFX files. This morning, I added the ability to override the built-in mappings with custom mappings that suite your needs.

Basically, you can take financial data from any institution and modify one of the existing mappings to provide the information needed for each export format. Once you’ve done that for your bank, you can import CSV data and export OFX or QIF for import into whichever financial software you prefer.

csv2ofx requires wxPython. You can retrieve the latest source with git:

> git clone git://github.com/mulicheng/csv2ofx.git 
> cd csv2ofx
> # use csv2ofx from the source directory
> ./csv2ofx
> # or install it site-wide
> python setup.py install
> # csv2ofx installed in path

You may also download a zip or tar archive from github if you prefer to grab a copy but don’t want to track the source repository. Go to the source repository for csv2ofx and click the download link.

There are directions in src/mappings.py and the README file for modifying mappings to suite your needs.

Contributions are welcome. Enjoy.

Update: 02/17/10
Added MS Money Rep and UBS support to csv2ofx

17 Comments »

  1. Thanks!

    This is exactly what I was looking for. Unfortunately, I don’t have the wxPython module installed. Based on my reading of this:

    http://www.wxpython.org/download.php#prerequisites

    I searched my repos for “python-wxgtk” — which I wouldn’t have come up with on my own — and installed python-wxgtk2.8

    Also, for what it is worth, I couldn’t get wesabe to load the OFX but the QIF worked.

    Comment by amanda — May 3, 2009 @ 9:03 pm

  2. Hi dear, I’vnt understand how to skip n-lines ! Please can you explain me.
    Thankx for your tool. 🙂

    Comment by zioalex — May 8, 2009 @ 8:03 am

  3. Have you an email where can I send my custom function and configuration for Fineco Bank ( an italian bank )?

    Comment by zioalex — May 8, 2009 @ 9:30 am

  4. You can use the contact me link.

    Comment by Dennis — May 8, 2009 @ 9:32 am

  5. Very nice. Can you recommend any documentation on how OFX works or how I should be approaching the mapping? I’m struggling to use what you’ve provided as a template and create a custom mapping for my Fidelity Investment accounts.

    I continue to run into this error:
    KeyError: ‘Split Type’

    But if I comment out the split line or get around that error another way I seem to just stir up more trouble.

    Comment by bdp — May 16, 2009 @ 3:10 pm

  6. The README file and the mappings.py file both contain documentation on the format of the OFX and QIF mapping requirements. I’d like to also start a wiki page on the github site where people can add custom mappings for additional banks. Part of the reason this tool is written the way it is is because it seems almost every bank has their own csv format.

    You can also send me a sample csv directly (using the contact me link above.) if you can’t quite get a mapping to work.

    Comment by Dennis — May 18, 2009 @ 8:55 am

  7. Getting this error with Yodlee generated csv when the script trys to save the file:

    Traceback (most recent call last):
    File “/Library/Python/2.6/site-packages/csv2ofx/__init__.py”, line 210, in OnExport
    csv2ofx_export(path,mapping,grid)
    File “/Library/Python/2.6/site-packages/csv2ofx/ofx.py”, line 16, in export
    if mapping[‘skip’](row,grid): continue
    File “/Library/Python/2.6/site-packages/csv2ofx/mappings.py”, line 99, in
    ‘skip’:lambda row,grid: fromCSVCol(row,grid,’Split Type’) == ‘Split’,
    File “/Library/Python/2.6/site-packages/csv2ofx/csvutils.py”, line 60, in fromCSVCol
    return xmlize(grid.GetValue(row,grid.GetColPos(col_name)))
    File “/Library/Python/2.6/site-packages/csv2ofx/csvutils.py”, line 44, in GetColPos
    return self.col_map[col_name]
    KeyError: ‘Split Type’

    Seems to import fine as I can see everything in place in the GUI. Any ideas?

    Many Thanks

    Comment by rme — October 3, 2009 @ 6:50 am

  8. You can try also my online converter at http://qifer.seasidehosting.st , only QIF target is supported but the user can choose freely the columns to convert.

    Paolo

    Comment by paolo — November 23, 2009 @ 6:49 pm

  9. Thanks for the script. I was able to use it to generate an OFX file perfectly. However, I wish to automate the process in a php script that will download a csv file from mint and then process it with csv2ofx. How can I call csv2ofx from within a php script so that I don’t have to use the gui? Thanks!

    Reuben

    P.S. if anyone wants a copy of my custom mint mappings, let me know.

    Comment by reubano — November 23, 2009 @ 10:47 pm

  10. Why don’t you post them to the wiki for csv2ofx on github:

    Comment by Dennis — November 24, 2009 @ 9:08 am

  11. For a windows desktop utility to convert CSV and QIF to OFX try iCreateOFX Basic from
    http://icreateofx.co.uk/Convert-CSV-to-OFX

    Comment by vybixa — May 4, 2010 @ 5:46 pm

  12. Hi,

    Have you got the PHP based script, as i dont know how to use python.

    Thanks.

    Comment by Suresh — July 4, 2010 @ 2:55 pm

  13. I am trying to figure out to start the gui.

    I have tried a few ways to open the xrc file.

    Can you supply a script to start the gui ?

    thanks
    Rand

    Comment by randfb — December 15, 2010 @ 10:48 am

  14. there is a desktop application (for Windows) to convert CSV to QIF. It’s called CSV2QIF at http://www.csv2qif.com

    As long as a CSV file has a header with common sense column names, CSV2QIF will figure out by itself the mapping and convert.

    Comment by seletit — January 24, 2011 @ 2:47 pm

  15. this is probably a stupid question.
    I’m new to Python. I’ve installed wxPython, and used these command:
    setup.py install
    import csv2ofx
    They all seemed successful.
    But then what should I do? How should I execute/run the programme?
    Thanks a lot.

    Comment by theo — May 11, 2011 @ 3:42 am

  16. Doesn’t seem to work at all and there is very little in the way of instructions. Kind of a waste of time really.

    Comment by jp — January 18, 2017 @ 8:25 am

  17. Unmaintained software. Sorry. After 7 years I wouldn’t be surprised if it no longer works at all. It’s open source though. Feel free to update it to current standards and software SDKs 😉

    Comment by Dennis — April 7, 2017 @ 11:08 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress

css.php
%d bloggers like this: