On Sat, Feb 25, 2012 at 08:20:03PM -0700, Zack Williams wrote: > On Sat, Feb 25, 2012 at 7:19 AM, Zack Williams <[email protected]> wrote: > > I'll have to try CSV2Ledger. > > Just tried CSV2Ledger, had a few comments: > > - running it on my system via MacPorts requires the following ports of > modules installed, and changing the shebang line to use /usr/bin/env > perl rather than a hardcoded path: > > p5-digest > p5-smart-comments > p5-template-toolkit > p5-text-csv > p5-timedate > p5-yaml
There are several modules required, nothing you should have to install by hand. Use your package manager or cpan. ;] > - I had some trouble importing my input file until I realized it was a > character set issue. Changing everything to utf8, then changing the > filehandle to read in in utf8 mode solved the issue - previously it > was showing a mismatch in the number of columns. I haven't added any unicode support whatsoever. I'm not confident of the unicode state of the modules, and I coded without unicode in mind. Patches are welcome to help address this, but I filter my data to ensure it only has basic ascii. > - It appears that ledger files it writes work fine in ledger 2.6.x and > hledger 0.17, but throw this error in ledger 3: > > Error: There cannot be null amounts after balancing a transaction > > I'm assuming this is because ledger 3 is trying to balance the > metadata lines - is there a reason they're in round brackets before > the semicolon ala automated transactions? Am I missing something > obvious here? CSV2Ledger uses a default template, or a template you specify to build the txns. It uses the common perl TemplateToolkit, and you can specify an alternate easily. I use custom templates, maybe there's a typo in the default. If you can isolate it, let me know. > > - There doesn't seem to be a way to not use check numbers - some of > the imports I've been doing lack a transaction/check number, and > importing them if omitting CheckNum in the FileMatches.yaml file > results in an "Use of uninitialized value in string ne at > ./CSV2Ledger.pl line 434, <FH> line ##" error. You're right, it requires the check number field. You can try setting it to the date column, or we can work on a patch to make it optional. I checked, there's already logic to omit it if the value is an empty string. > > - One interesting difference - hledger csv conversion is that I can > match more than one regex into a one destination account, whereas > CSV2Ledger can set both the source/destination accounts but would need > a more complex regex to match unrelated lines. Maybe a sort format > that assumes that un-regex-quoted lines are regexes that start with > '^', and quoted start with 'm', and have the last line specify > source/destination accounts ala this: > > Bank > /.*tax/ > Assets:Checking => Expenses:Business > Currently I use the YAML files to store dispatch tables... They are just lists of rules in a common format (regexp, string, string). The regexp format is YAML's requirement. I have some fairly complex rules I can post examples of, and remember the regexp is applied against the raw csv so you can include tests against multiple fields. Also there are "default" accounts you can use. You may need to rephrase your question though, I'm not sure I understand the paragraph above. > - I really like the preprocess directive. Some of my CSV files have > consecutive spaces in the description fields, which messes up ledger, > and fixing this previously required an additional step. > I use the preproc to rename known vendors, to filter ascii, etc. It's quite useful. Glad you like it! > - The dedupe works great. This is key for me too! > > Thanks, > Zack > ------------------------------------------------------------------ Russell Adams [email protected] PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
