Perl CWMoney DB hack

I usually use CWMoney to keep track of where I spend my money and to help to stay on budget. However for the last year I have been rather lazy and haven’t been entering my financial data. I keep putting it off because it is tedious.
I had previously asked the developers to add a import feature so I could add *.csv files to the app but nothing happened. I decided to give it a go in Perl.
I used SQLite Browser to help me visualize changes and understand the structure of the database.
The app turns out to be quite simple. The transactions are stored in the “rec_table” and the categories of transactions are stored in the “kind” and “kinds” table.
Screenshot from 2018-10-11 04-57-59.png
I first used SQLite Browser to craft a SQL query to add an entry and checked that it was picked up by the program. After crashing it a few times I figured out which fields are necessary. I then used DBI::SQLite to drive the database.

Using small iterations I was able to get to a point where %80 of my transaction were filtered and entered into the relevant categories. These transactions come from multiple banks with different account types.
I was thinking about adding a dynamic row picker to make the program compatible with any CSV file type, but for now it does it’s job. I couldn’t imagine how many hours it would take to enter those transactions by hand.
Here is the code:
[gist /]

Leave a comment

Your email address will not be published. Required fields are marked *