[GNC] Use Piecash to Import Transactions Creating Account Structure

flywire flywire0 at gmail.com
Sun Jul 18 05:09:42 EDT 2021


I previously mentioned piecash will easily import csv transactions. It also
creates the account structure in the process.

piecash is a GnuCash compatible python library. It doesn't use GnuCash but
creates files that are compatible with GnuCash. piecash is an alternative
to the python bindings which are optionally part of GnuCash and use
GnuCash. See https://piecash.readthedocs.io/ for details.

----------------------------------------

The example below uses data based on GnuCash Tutorial and Concepts
Guide Part II. Managing Personal Finances -
https://gnucash.org/viewdoc.phtml?rev=4&lang=C&doc=guide

The sample code needs a code folder that must contain
`simple_csv_book_creation.py` and `demo.csv`, and a folder named
`gnucash_books` at the same level as the code folder.
`simple_csv_book_creation.py` must be run from the code folder.

D:\demo
|------ examples
|        demo.csv
|        simple_csv_book_creation.py
|
|------ gnucash_books

Install python Version 3

D:\>pip install piecash

D:\demo\examples>python simple_csv_book_creation.py
Created:  ../gnucash_books/simple_csv.gnucash

The file created can be opened in GnuCash.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple_csv_book_creation.py
Type: text/x-python
Size: 3553 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-user/attachments/20210718/2f60caee/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: demo.csv
Type: application/octet-stream
Size: 1098 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-user/attachments/20210718/2f60caee/attachment.obj>


More information about the gnucash-user mailing list