September 23, 2012
I've been keeping an eye out for an alternative to QuickBooks to handle small-business accounting. Sure, QuickBooks is big and comprehensive, but I only use 5% of it, and frankly I'd rather do that 5% much differently.
The recent craze of plain-text writing and blogging workflows has brought me back to a project that I've been circling around for several years. You may not know this, but there is a plain-text accounting system. It's called Ledger and it's amazing.
The idea behind John Wiegley's Ledger is that you type your transactions into a great big text file. You then run the super-fast Ledger command-line processor, and specify what sort of output you'd like to see, such as a list of account balances or a detailed register for a particular account.
Think about that for a second. Every single one of your transactions is crunched when you're simply curious about how much is left in your chequing account. Sound crazy? Not really, because Ledger is so screamingly fast (and, being devoid of UI, so efficient at processing large batches of transactions), that in the time it would take you to submit a single transaction in QuickBooks, Ledger can process them all.
Once you bend your mind around this unusual process, you start to see the possibilities. TextExpander snippets for common transactions. Scheduled jobs for generating and e-mailing key reports. A bare-bones web UI for report generation, perhaps that your accountant can access. Simple integration with your website or other systems. There are a lot of interesting things you can do when freed from the constraints of UI-laden accounting software.
So, how to start? I made a Ruby script that converts your entire QuickBooks transaction history into something that is immediately usable in Ledger. So usable, in fact, that your Ledger trial balance should match your QuickBooks trial balance.
Here's how to use it:
In QuickBooks, generate a Journal report for the date range All. In my version of QuickBooks, this is in Reports > Accountant & Taxes > Journal.
Export to a comma separated values (.csv) file, say journal.csv.
Run the script as follows:
qb2ledger journal.csv > ledger.dat
Now you can run Ledger directly against this data file. So, for a list of account balances, you could run:
ledger -f ledger.dat bal
So far I have found one annoyance: older versions of QuickBooks don't escape double quotes when exporting the CSV file. That means you'll have to go through and escape them yourself if you happen to have a few double-quotes scattered around your transaction memo fields. I had a number of things like Samsung 15" monitor, for example. To help with this, you can use this regexp to search for double-quotes that don't belong:
Once you find them, you can simply preface them with a backslash to allow qb2ledger to parse them properly, or do what I did and get rid of them in the original QuickBooks transactions before doing the export.
Now, rather than moving all of your historical transactions over to Ledger, you may just want to close off that set of books and start a new one. In fact, I might go this route myself, but this script is still useful for getting a handle on how Ledger could work for you. And that's important, because Ledger isn't for everyone. If you know your way around double-entry accounting, though, and want a fast, powerful, extremely flexible sledgehammer of a solution, you should take a look.
Have more questions about Ledger? Take a look at the Ledger site or read through the full documentation. There is an IRC channel as well, #ledger on freenode. Have questions about my qb2ledger script? Ask me on Twitter.