Recently I have wanted to start keeping better track of my finances. To do this I started using a personal financing software called HomeBank to keep track of my spending. Virtually all of my different financial accounts offer ways in which to export my monthly statements so I could then import them into my software for tracking. This was great and made tracking everything really easy, thought not everything was as easy a I would have liked. For one of my account, my bank account specifically, the only option I had for exporting my statement was to use a CSV (Comma Separated Value) file. This is better then nothing at all, but CSV does not have a standard for exporting financial data and HomeBank (like many finance software) can not just import the data as is. This would mean that I would need to manually enter each transaction into HomeBank if I wanted to do expanse tracking. This was going to be an issue, the main reason I was using the software was to track spending almost automatically and I would not be doing that if every entry had to be done manually.
After learning about this pitfall, I came across another, for a different service I use. For online shopping, I like to use PayPay and they also offer a way to export my statements for use with accounting software. The issue I came across is that when I go to export my statement as a QIF file (Quicken Interchange Format), which is a financial file standard, there is data not included. When I use PayPal, I use it as a payment processor for my credit cards or bank accounts, meaning I don’t owe a balance to PayPal. When you export your statement from PayPal as a QIF this is not reflected, rather it seems as you have an unpaid balance with the company, which doesn’t help when trying to track your finances. To get the correct representation of all my transactions, I needed to make an export of my Balance Affecting Payments which is a CSV.
This put me into the same situation I’m in with my bank statements. I have files full with the information I want with no way to put them into my fiance tracker. I decided to creat my first Python program.
I had done some research before I started my project and found some other projects to do similar things to what I wanted but nothing I really liked. I was looking for a way to convert my files into something that I could use and was flexible to use with the two different files I have. I also found that QIF is an open specification that is fairly easy to use and is accepted by most finance software.
With a few prior classes from Codecademy in Python and a google window opened, I decided that this would make a fun project to tackle with the few days I had off due to the holidays. It turns out the process of converting between the two file types wasn’t that hard to do and I am taking to Python fairly well. I can’t say that the code I wrote is great, but it does work and is not too bad for my first attempt.
The way you use the program is simple. All you need to do is pass it three files. Those three files (in order) are the file to be converted, the file to be exported and the definition file describing where the data you want is in the input CSV. The definition file is really what helps make the whole thing work, as the files from different places (PayPal, the bank, etc.) are going to have different layouts, and by having a way to tell the program where the important data exists you can easily transform the data. More information on the definitions file can be found on the GitHub page linked below.
While this program is still very much a Beta, it does work and I am using it. There are features I would like to add to make it more flexible, I plan to keep working on it to make it better. Suggestion are welcome.
Update (1/19/2016): I made an update to the code (0.2 now!) which adds the ability to leave the Payee blank when you use -1 in the definitions file. I have a few more changes I want to make which might warrant a new post.
You can find the Program and example files on my GitHub: HERE (https://github.com/M-tech-Creations/CSV-to-QIF)