Command line to dump data as plain text files

John Ralls jralls at ceridwen.us
Sun Apr 16 10:42:30 EDT 2017


> On Apr 13, 2017, at 7:52 AM, CY Lim <cheeyee.lim at gmail.com> wrote:
> 
> Hello all,
> 
> I cannot seem to find how to use command line to dump data from GnuCash
> into a single or multiple plain text files (e.g. csv). Any suggestion will
> be helpful.
> 
> If that cannot be done with command line, I am happy to use API provided in
> C or Python to access the data. Some examples or documentations are
> appreciated.
> 
> I want to avoid manual parsing of the files, unless what I need is not
> doable with the 2 methods above.


There is no export facility available from the command line, and only limited export (of transactions and splits to csv) from the GUI. You can of course get to any data you want from C and to most of it from Python, and there's also https://github.com/sdementen/piecash <https://github.com/sdementen/piecash>, a third-party framework for working with the XML file. But...

GnuCash uses by default a plain text file in XML, though it may be compressed with gzip. You can turn off compression in Preferences, on the General tab, or you can gunzip the file; GnuCash doesn't care about compression at load time. The not-default storage is in SQL with one of SQLite3, MySQL, and PostrgresQL. Most people who want to query their GnuCash data outside of GnuCash find that to be the easiest way.

Regards,
John Ralls



More information about the gnucash-user mailing list