Command line to dump data as plain text files

Christopher Lam christopher.lck at gmail.com
Sun Apr 16 19:29:18 EDT 2017


Hi, I extended a lightweight Python3 library by jorgenschaefer which can
provide read-only access to xml files. It handles comporessed xml too.
https://github.com/christopherlam/gnucashxml

This also has .ledger output facility:
import gnucashxml
book = gnucashxml.from_filename("datafile.gnucash")
print(book.ledger)

On 16 April 2017 at 22:42, John Ralls <jralls at ceridwen.us> wrote:

>
> > 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
>
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
>


More information about the gnucash-user mailing list