"sam is typing..."

(A Blog by Sam Marshall)

Converting the QIF file my bank lets me download to a hledger file

2019 01 26

hledger has caught my eye as a tool for budgeting. It keeps everything in a nice, simple and easy to manipulate text file. I add entries using vim. It even lets me do YNAB-style envelope budgeting which I’m experimenting with.

When I use YNAB, I have a different process. I download a QIF file from my bank, plug it into YNAB and fill in any missing information, checking off each transaction in turn. This is a lot less manual. Ideally I’d like something closer to this for hledger, except with my review step happening in vim.

I decided to have a play around and see if I could get something thrown together in racket - and it ended up being much quicker than I anticipated. I used a parser combinator library based on parsec (parsack) written in racket to build a quick parser for the QIF subset I could identify, and then some equally quick functions to convert it all down into something that looks a bit like a hledger string. The library is on my gitlab account.

This is all I need for now. I can run my bank exports through this little script, appending the output to my hledger file. I just need to go in and remove any duplicates, filling out what category the expense lives in as I go and adding any notes.

In the future, it might be nice to add some management of duplicates, I’d rather not be doing that myself - but for now, it does the job!