simonmichael / hledger

Robust, fast, intuitive plain text accounting tool with CLI, TUI and web interfaces.
https://hledger.org
GNU General Public License v3.0
3.07k stars 320 forks source link

Import Gnucash Files #332

Open juergenhoetzel opened 8 years ago

juergenhoetzel commented 8 years ago

It would be nice to import GnuCash (2.6+) XML files. This feature has been deprecated from the original ledger implementation. But It seems John is porting this feature again for the next release: http://bugs.ledger-cli.org/show_bug.cgi?id=182

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/32168379-import-gnucash-files?utm_campaign=plugin&utm_content=tracker%2F536505&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F536505&utm_medium=issues&utm_source=github).
TomK32 commented 8 years ago

I have a script that prints out hledger transactions from a GnuCash SQLite database. Uses ruby and activerecord. https://gist.github.com/TomK32/2dcb66bc238cc11ba475

simonmichael commented 8 years ago

Nice! I'll try this on my old gnucash data as soon as I can fix sqlite saving on OSX.

juergenhoetzel commented 8 years ago

@TomK32 Works nice at first glance. Thanks!

It would be nice to also convert GnuCash XML files (this is what I use for storage).

simonmichael commented 8 years ago

There's also https://github.com/MatzeB/pygnucash/blob/master/gnucash2ledger.py

juergenhoetzel commented 8 years ago

@simonmichael Thanks for the hint.

Its also sqlite3-based. Somehow I always preferred the default XML storage in GnuCash. Maybe also because it's text based and doesn't depend on DBs.

badmutex commented 8 years ago

FWIW I've had success with MatzeB/pygnucash. I had to remove the commodity and account declarations but otherwise this worked great.

This was tested with hledger 0.27 with a gnucash 2.6.6 sqlite database.

simonmichael commented 8 years ago

Good to know. Current hledger-master supports the commodity and account directives (though not all of Ledger's subdirectives).