[GNC] Multi-split CSV Import
Geert Janssens
geert.gnucash at kobaltwit.be
Fri Aug 20 05:54:18 EDT 2021
Multisplit is a gnucash specific variant of a csv file. In short it's csv in which certain fields can be left empty if they are the same on consecutive rows. This avoids having to repeat transaction specific data for each split of a transaction.
Or put differently, the format expects full transaction details, both transaction specific and split specific.
Each line should define
- one split via split specific fields (account and deposit/withdrawal as bare minimum) *and*
- to which transaction the split belongs via transaction specific fields (date and description as bare minimum).
There is a convenience built in that you don't have to repeat the transaction fields if the split belongs to the same transaction as the previous one (though you can repeat them if that makes csv preparation easier)
Missing date does not define whether or not import data is multi-split or not. The requirement is that we need a date for every transaction to import. Given that for a multi line import only the first line of a transaction requires transaction fields set, it follows that multi line import data may have secondary line that have no date field set.
Then there's the question of why account data is fully filled on csv export. I can think of a few motivations I had back then:
1. the intention of the exporter is to create a file that can be imported with minimal effort. So if you export a file from a gnucash data file and import it in another, only the accounts should be trained once. If one account would be missing from the import data the transaction matcher would have to be trained as well.
2. The transaction matcher code also predates the multi line import implementation and I honestly don't know how well it would handle imbalanced or incomplete multi-split transactions. It may well work but it was too much of a scope back then to test all of that as well. So the multi line import's primary use case is data that fully describes each transaction, including an account for each split. It may be possible to change that to the same concept of incomplete transaction data where an imbalance in the provided splits is handled via adding a balancing split in:the base account. That would require careful study of the transaction matcher and a lot of testing.
Regards,
Geert
flywire <flywire0 at gmail.com> schreef op 20 augustus 2021 09:44:32 CEST:
>CSV Import is documented in
>https://www.gnucash.org/docs/v4/C/gnucash-help/trans-import.html#trans-import-csv
>In a lot more detail than the Guide and Concepts Manual (which is
>hardly
>more than a list of headings).
>
>The only dataset demonstrated is a screenshot in Figure 6.5. The CSV
>Import
>Preview Panel
>https://www.gnucash.org/docs/v4/C/gnucash-help/figures/Help_CSV_Import_transactions_Preview.png
>
>So, the csv imports account transactions with the transfer account.
>
>* Multi-split: Selecting this check box allows the splits for a single
>transaction to be defined on consecutive lines within the file with
>each
>line defining a single split. If not selected each line is assumed to
>contain the information for a single transaction including one or two
>splits;
>
>A file or at least an image is needed to go with that multi-split
>statement.
>
>From the manual it's clear all that is required are the extra splits,
>but
>this isn't the case is it? In a previous post the direction is just
>export
>a multi-split and look at the file.
>
>Required data: Date, Deposit/Withdrawal, Description??, Account,
>Transfer
>Account??. I haven't been through the code but understand a missing
>date
>entry indicates it's a multi-split (so csv lines aren't data records in
>the
>normal sense). That's a lot simpler than a csv export. An export has an
>account line for *every* transaction. Why would that be required for a
>csv
>import of an account when it isn't needed for single splits? It's
>redundant
>data complicating file preparation.
>
>I expect CSV Import is fairly close to the initial process for most
>users
>and I knew something wasn't right about it compared to other software.
>It's
>described in The Emperor's New Clothes (as with the definition of
>split).
>_______________________________________________
>gnucash-user mailing list
>gnucash-user at gnucash.org
>To update your subscription preferences or to unsubscribe:
>https://lists.gnucash.org/mailman/listinfo/gnucash-user
>If you are using Nabble or Gmane, please see
>https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
>-----
>Please remember to CC this list on all your replies.
>You can do this by using Reply-To-List or Reply-All.
Sent from my smartphone. Please excuse my brevity.
More information about the gnucash-user
mailing list