[GNC] Writing GCM File

David T. sunfish62 at yahoo.com
Sat Jan 31 03:41:08 EST 2026


Hello,

I am a longtime GnuCash user (19 years) with GC 5.14 (2025-12-10 build) 
on Windows 11.

I was reading a thread recently regarding register column widths, and I 
decided to try to work out a mechanism to set column widths for every 
account in my book, by account type. Specifically, I wanted to ensure 
that any account of type STOCK or MUTUAL had rational column widths for 
balance, debit, credit, price, and shares.

I started by opening an existing gcm file and noting the column width 
variables. Every register that has had its columns set has a section in 
the gcm file with values for all columns, identified by the account GUID:

[Register XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX]
date_width=133
num_width=44
reconcile_width=33
balance_width=130
transfer_width=600
debit_width=125
credit_width=125

Accounts of type STOCK or MUTUAL have additional lines:
shares_width=100
price_width=133

I figure that I should be able to write out a gcm file with column 
settings for every account in the book, and this *should* make it so 
that any account I open gets my preferred column settings--regardless of 
whether I have actually set the columns on that register.

I created a simple python script that takes a csv list of all accounts 
in my book (derived from an SQL copy of my data file, and the SQL query 
"SELECT guid, account_type FROM accounts;") and writes my preferred 
column settings into a new gcm file.

For full disclosure, I started with a copy of the existing gcm file, 
stripped out all register-related data, and then pushed new register 
settings combined with this base gcm data into a new text file.

In theory now, if I put this new gcm file into the proper location (in 
my case, c:\users\sunfi\AppData\Roaming\Gnucash\books\myfile.gcm) and 
fire up GnuCash, I would expect every account to open with the new 
preferred column settings.

Unfortunately, that doesn't seem to happen. Once GnuCash opens, it seems 
to rewrite every single entry in the gcm file to some preset values 
based on some sort of unspecified criteria, undoing the changes I 
inserted. So, for example, if I set debit_width in every case to be 125 
(as above), once I open GnuCash, the debit_width *in every single entry* 
gets reset to 88.

Do any devs have insight into what is going on here? Why doesn't GnuCash 
respect its own gcm file settings? Why rewrite this file in this way? Is 
it even possible for me to set column widths in the gcm file and have 
them persist?

I would really like to have my register settings a certain way, and 
going through a thousand registers one by one to reset the columns is 
not viable.

-- 
David T.



More information about the gnucash-user mailing list