18

I wrote a script that cleans up OFX transaction files downloaded from banks so that the name and memo fields are more readable once imported into gnucash. This works great, I now get very clean records that include only the information I need for each transaction. The problem is, even after the clean up, gnucash's bayesian matching makes a lot of mistakes in matching transactions to accounts, and frequently "forgets" matchings it knew in the past.

I was wondering if there is anything else I can do to the OFX files in my cleanup script to give gnucash better hints as to what account a given transaction should go. I would like to bypass the bayesian matching stuff completely, and instead insert an explicit account name for each transaction in the OFX file. Looking through the OFX spec I could not find any fields for this. Is this possible at all?

If I could do that, then my script can assign default accounts for the common transactions that show up over and over again, like groceries, gas, etc. Then I'll have only the exceptions to handle manually.

Thanks.

Miguel
  • 331
  • 2
  • 7

3 Answers3

7

You can generate the transactions directly into your GnuCash XML file via the GnuCash python bindings. You could probably alter your script to directly generate the XML for the transactions into your GnuCash database in this manner. You would then open GnuCash and everything would already be there.

See a simple example which creates some accounts and transactions, and the docs for the python bindings.

Stephen Rauch
  • 103
  • 1
  • 1
  • 5
John Lyon
  • 353
  • 3
  • 9
5

You can turn off bayesian matching, so you can bypass it like you want to do without messing with the import file.

Go to Edit->Preferances, Online Banking tab, uncheck "Use bayesian matching"

From the gnucash documentation, about half way down this page: http://code.gnucash.org/docs/help/set-prefs.html

Patches
  • 3,501
  • 1
  • 17
  • 25
1

It looks like you're right, in that the OFX spec doesn't support what you're trying to do, which means that GnuCash probably won't support it.

As a last option, you could build a GnuCash plugin to to this (http://svn.gnucash.org/docs/HEAD/group__Plugins.html), but it doesn't seem like a very easy architecture to get into.

Jeremy
  • 1,163
  • 9
  • 13