On Sun, Sep 23, 2012 at 6:34 AM, Eric Abrahamsen <[email protected]> wrote: > I've got some text files from my Chinese banks formatted according to > their own system. I'm planning on just using Python to slurp the file > in, but I'll need to write it out to ledger format. What's the best way > of doing that? I didn't see anything in the /python or /contrib folders > that look like ledger writers. Should I just use a string template?
I personally separated the tasks - I have one script that goes from input file (in my case, PDF's from banks) to a CSV file, then another script that goes from CSV to ledger. There's a plethora of tools that go from CSV to ledger. > Given that I'm conversant in python and bash, and not likely to be > learning any C/C++ anytime soon (though I can copy-and-paste with the > best of them), what's my best option for writing a ledger file from > python/bash data? I'd figure out whatever templating library you like in Python if you want to handle that portion of it. If you want something to start with, I wrote my own in ruby (mainly because it has the ERB templating engine built in): https://github.com/zdw/rubycsv I was using hledger for this, but needed to generate complex multi-line entries, such as ones with purchase/tax/shipping broken out from a single CSV line. These are common problems when dealing with payment processors like Square and Paypal. - Zack
