[GNC] Example of multi-split feature of CSV importer?

Geert Janssens geert.gnucash at kobaltwit.be
Mon Mar 18 06:45:06 EDT 2019


Op zondag 17 maart 2019 00:55:38 CET schreef Patrick:
> I would like to import split transacations from a CSV file. Based on the
> help balloon for it, the "multi-split" option seems to be the way to do
> this, but I am not sure how to use this option. Is there an example
> somewhere of how to use this option?
> 
> To be specific, what I don't understand is that when the multi-split option
> is disabled, I can set one column in the CSV to be the "Account", and
> another column to be the "Transfer Account". Setting these two columns
> allows me to specify the "credit" and "debit" accounts involved in the
> transaction. However, when I enable the multi-split option, the option to
> set a "Transfer Account" goes away. So, I am not sure how to specify the
> second of the two accounts involved with the transaction when multi-split
> is enabled.

First off, strictly speaking each transaction is "multi-split" as even the simplest transaction (a 
transfer from one account to another) has two splits: one in the source account and one in the 
target account. The split itself doesn't know about the transfer. It only knows which account it 
belongs to.

As a real example is always more helpful, let's assume a transaction that transfers $100 from 
Account A to Account B. This would be represented with two splits:

Transaction date 2019-03-18
Transaction description "Transfer"
Split 1: Account A        $100 (Withdrawal)
Split 2: Account B                                       $100 (Deposit)

Converting this in a multi-split csv file that can be imported would yield something like this:
Date,Description,Account,Deposit,Withdrawal
2019-03-18,Transfer,Account A,,100
2019-03-18,Transfer,Account B,100,

As you can see there is no need for a "Transfer Account" column in this case. Each split is 
associated with one account, you only have to define that account. GnuCash will use the 
transaction related fields (in this case only "Date" and "Description") to detect transaction 
boundaries. As both fields are identical on each line, GnuCash will assume both splits to be part 
of the same transaction.

The single-line import format is a shorthand that can only be used in case of transactions with at 
most two splits. For that situation each line represents such a full transaction and hence may 
hold information to define two splits. For that reason it also provides two Account assignments 
options (Account and Transfer Account) as each split in that transaction can have one. So the 
above translated into a single line csv file would look like this:

Date,Description,Account,Transfer Account,Deposit
2019-03-18,Transfer,Account B,Account A,100

You could say the single line import format is a special case to simplify most imports from bank 
accounts while the multi-split format is more generic and the only format that will ever be able 
to import multi-split (that is more than two splits) transactions (1).

Regards,

Geert

(1) Note there are currently issues with the csv importer for multi-currency imports or stock 
imports. These will eventually be resolved allowing the multi-split format to import every kind of 
transaction gnucash supports internally.


More information about the gnucash-user mailing list