Skip to content

A script to convert GNUCash's XML file to Ledger's dat file

License

Notifications You must be signed in to change notification settings

icyflame/gnucash-xml-to-ledger-dat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GNUCash's XML to Ledger's Dat File

A script to convert GNUCash's XML file to Ledger's dat file

convert.pl is the script to convert GnuCash's uncompressed XML file to a Ledger journal. I run it using Perl 5.26 on a computer running Ubuntu 18.04.

The file formats for ledger and hledger are very similar, I have been able to generate repors using hledger for the dat file created by the conversion script.

Note: There are other scripts which do the same thing as the Perl script in this repository.

Recipes

Don't install anything

hledger () {
        docker run --rm -v `pwd`:/data -w /data dastapov/hledger hledger $@
}

ledger () {
        docker run --rm -v `pwd`:/data -w /data dcycle/ledger:1 $@
}

Display numbers in the correct format

Commodity directives can be used to ensure that numbers are always displayed in the appropriate format.

$ cat commodities.dat
commodity JPY 1,000,000.
commodity EUR 1,000,000.00
commodity USD 1,000,000.00
commodity INR 10,00,000.

; Enter the appropriate exchange rate for the various commodities here
P 2020-02-08 EUR 0.001 USD

Generate common accounting reports

hledger -f simple.dat incomestatement
hledger -f simple.dat balancesheet
hledger -f simple.dat cashflow

Display all balances in a single currency at present exchange rate

# You _must_ have the exchange rate in USD for all the commodities in the
# commodities.dat file
hledger -f simple.dat bal Assets -Y --value=now,USD

License

Code in this repository is licensed under MIT.

Copyright (C) 2020 Siddharth Kannan [email protected]

About

A script to convert GNUCash's XML file to Ledger's dat file

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published