Converting financial CSV data to OFX or QIF import files

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:

  1.  
  2. > git clone git://github.com/mulicheng/csv2ofx.git
  3. > cd csv2ofx
  4. > # use csv2ofx from the source directory
  5. > ./csv2ofx
  6. > # or install it site-wide
  7. > python setup.py install
  8. > # csv2ofx installed in path
  9.  

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

15 Responses to “Converting financial CSV data to OFX or QIF import files”


  1. amanda

    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.

  2. zioalex

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

  3. zioalex

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

  4. Dennis

    You can use the contact me link.

  5. bdp

    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.

  6. Dennis

    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.

  7. rme

    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

  8. paolo

    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

  9. reubano

    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.

  10. Dennis

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

  11. vybixa

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

  12. Suresh

    Hi,

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

    Thanks.

  13. randfb

    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

  14. seletit

    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.

  15. theo

    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.



css.php