Bug 328140 - Add category and subcategory into csv import
Summary: Add category and subcategory into csv import
Alias: None
Product: kmymoney
Classification: Unclassified
Component: general (show other bugs)
Version: git (master)
Platform: Mint (Ubuntu based) Linux
: NOR wishlist (vote)
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
Depends on:
Reported: 2013-11-27 11:34 UTC by allan
Modified: 2014-01-27 12:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description allan 2013-11-27 11:34:07 UTC
{From the list - On 12/11/13 03:49, Louis-Philippe Allard wrote:}
    Because I am trying a lot to import data from a CSV file, I have
    realized that i'd be nice to have the possibility to map additional
    columns from the CSV file into additional fields in KMM.  For example,
    the current import wizard doesnt allow importing transaction categories.

    The only fields as of now are Number, Date, Payee/Decription, Memo,
    Amount, Debit/Credit...

    Categories could follow a hierarchical scheme such as for example for a car:

    ---->Driver's license

    Importing a transaction with the field "Car/Maintenance"  would import
    the transaction and assign it under the

    ----> Maintenance

Do you see this as an on-going requirement, or just an initial setting up need?  Where would the input file originate?  The reason I ask is that initially I wrote the plugin to import from banks, which would have no knowledge of KMM categories, so didn't foresee such a need.

If you still see such a requirement, it would be as well to create a wish-list item on https://bugs.kde.org, so that it's not forgotten. At the foot of the bug report, change the severity to Wishlist.
If available, I'd use this feature often.  I normally enter the transactions from our credit and debit cards as they occur, independently from the bank statements, but as we got a huge backlog of round 1000 transactions to sync in the KMM database, I opted to import a CSV containing all 1000 transactions.  The problem with this approach is that unless you assign a default category to the payee in KMM, the transactions will not get assigned to a category which will require you to manually edit and assign a category to each of the 1000 transactions...
 Again, provided the feature is in KMM, I'd rather open it with a spreadsheet editor, add another column in the CSV file, add the categories, then save it as CSV and import in KMM.  Sometimes, (more often than you may think) a payee will have more than one category assigned to it... A good example are those truck stops where you can fill up your gas tank and eat.
 The possibility of having a Category field in the CSV BEFORE importing in KMM would allow me to manually assign a category to a payee..
{Another request -zdenek.elis@gmail.com }
my feature request is to add category and subcategory into csv import

Reproducible: Always

I've been looking at this, and it should be possible, with a couple of caveats.

The point about multiple categories could be a problem.  For instance, how would they appear on a spread sheet?  If they were extra columns for the one transaction, how can they be captured in a way that KMM will understand.

Secondly, the question of transfers I've not looked into.
Comment 1 allan 2014-01-13 21:46:00 UTC
I've produced a patch to add categories and subcategories to CSV import files.  The patch is fairly large, as it involves a rework of one wizard page to add an additional widget into the existing grid, and also requires moving two routines from one class to another.
There is another, unrelated, fix, which is just a few lines, for a problem noticed during testing, where an input file may be missing a return character on the last line, which resulted in that line being inaccessible.
All the changes are within the CSV plugin and are pretty straight-forward.  Because of this, I wan't intending to submit to the reviewboard, but will obviously do so if necessary.
Comment 2 allan 2014-01-27 12:32:31 UTC
Git commit cc89ef7f1a099af77d9f4f1d664320c1a9da7db8 by Allan Anderson.
Committed on 25/12/2013 at 00:04.
Pushed by allananderson into branch 'master'.
Also, fix inabilty to import last line of CSV file if it has no return character.

M  +344  -108  kmymoney/plugins/csvimport/bankingwizardpage.ui
M  +103  -10   kmymoney/plugins/csvimport/csvdialog.cpp
M  +20   -0    kmymoney/plugins/csvimport/csvdialog.h
M  +146  -3    kmymoney/plugins/csvimport/csvutil.cpp
M  +2    -0    kmymoney/plugins/csvimport/csvutil.h
M  +1    -135  kmymoney/plugins/csvimport/investprocessing.cpp