[GNC] Adding Transactions From Another Program

Hal Vaughan hal at hal.dance
Tue Apr 28 15:11:29 EDT 2020


I’ve done some research on this issue and I’m trying to determine if it’s worth doing more or if I’d just spend time on this topic and find it won’t work.

I have a situation I’ve been told GnuCash can’t handle, but I have a Python library that can handle it.  (It has to do with calculating interest on a credit line with a variable balance.)

Years ago, I remember checking into GnuCash and reading the XML data files and finding that each transaction seemed to have a UUID with it, but that the other data in each entry would be easy to generate from my own library written in Python.  I also know that now the data files can be in SQL, using several different engines, and that if it’s an XML file, it’s in gzip format.

I do not need my program to run as a plug-in or anything like that.  (Last I looked, I had to install MacPorts for that, and last time I installed MacPorts, it made a mess of the libraries for my old Perl scripts and some Python ones.)

But here’s what I’d like to do:
1. Enter my transactions involving the credit line normally in GnuCash.
2. Exit GnuCash
3. Run my Python script that would read the GnuCash data file and find all transactions with any credit lines.
4. Do the interest calculations for my credit line
5. Add a debit transaction for the interest amount before each new transaction with the credit line
6. Edit the comment field for each transaction involving the credit line to include notes on interest and totals
7. Save the ledger and exit my library script.
8. Run GnuCash again and have the new transactions included and their amounts included in any account totals.

Is this even possible?  I don’t mind doing the research to find out how to generate a transaction ID and all the rest.  I just want to know if I can use my own library to add transactions to a file (or edit comments in a transaction) and, when I’m done, for GnuCash to be able to read that file, with my new transactions, in and to include the amounts in the added transactions in account totals.



Hal


More information about the gnucash-user mailing list