gt is a command line tool that performs convenient actions on a
gnucash sqlite3 database.
warning: gt can destroy your gnucash sqlite3 database
gt is not associated with the gnucash project in anyway. There is no
guarantee that any action performed by gt will not corrupt, destroy or
modify in an unexpected way a gnucash sqlite3 database. If you choose to
use gt, please backup your gnucash sqlite3 database before doing so.
I had completed a migration of transactions into gnucash and needed a way to bulk edit many transactions. At the time, there was no support for bulk editing transactions within gnucash. There are libraries that provide access to the gnucash sqlite3 database though I had written enough code that worked on the gnucash sqlite3 database to be comfortable in writing my own tool.
Build:
$ go build -o ./gt ./cmd/gt/main.goThe gt config file defaults to ~/.gt.json which supports these
options:
{
"gnucash_db_file": "/home/user/.gnucash.sql.gnucash"
}List accounts:
$ gt account listList accounts that have Groceries in their name:
$ gt account list --name-like "Groceries"Get an account by guid:
$ gt account get 9b1d2bc513da4076b236aee6114b21a7Get an account by account tree:
$ gt account get expenses:groceriesList transactions:
$ gt transaction listList transactions for account guid:
$ gt transaction list --account 9b1d2bc513da4076b236aee6114b21a7List transactions for account tree:
$ gt transaction list --account expenses:groceriesList transactions starting from a date with a description that contains %Pizza:
$ gt transaction list --start-post-date 2024-01-01 \
--description-like "%Pizza"Update a transaction account:
$ gt transaction update 0000000000000000fa1ce5381fec0d51 \
--source-account expenses:pizza
--destination-account expenses:diningUpdate many transactions account based on their description:
$ gt transaction bulk-update \
--description-like "%Pizza" \
--source-account expenses:pizza \
--destination-account expenses:dining