# Can hledger import use account mappings from previous transactions?

**URL:** <https://forum.plaintextaccounting.org/t/can-hledger-import-use-account-mappings-from-previous-transactions/84>\
**Category:** Reddit\
**Tags:** hledger\
**Created:** [March 9, 2024, 12:59am UTC](https://forum.plaintextaccounting.org/t/can-hledger-import-use-account-mappings-from-previous-transactions/84 "2024-03-09T00:59:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![redditbot](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.plaintextaccounting.org/redditbot/32/42_2.png) [@redditbot](https://forum.plaintextaccounting.org/u/redditbot)\
**Post date:** [March 9, 2024, 12:59am UTC](https://forum.plaintextaccounting.org/t/can-hledger-import-use-account-mappings-from-previous-transactions/84/1 "2024-03-09T00:59:38Z")

</div>

Is there any way to have hledger use account mappings from previous transactions when calling `hledger import`?

 

For example, say I import an expense with description "Foo" and I manually set `account2` for that expense to `expenses:shopping`. With regular ledger, if I import another transaction with description "Foo" later on, ledger will automatically set `account2` to `expenses:shopping` because it matches an existing transaction.

 

Is there anyway to get this behavior in hledger?

 

Right now I've been adding all the mappings to a CSV rules document, but writing an explicit rule for every single description/payee in my journal feels overkill. In a perfect world hledger would use my CSV rules files first, and then fall back to existing entries if no rule is found.

 
 submitted by [/u/-cvdub-](https://www.reddit.com/user/-cvdub-)   
 [[link]](https://www.reddit.com/r/plaintextaccounting/comments/1arkzfg/can_hledger_import_use_account_mappings_from/)[[comments]](https://www.reddit.com/r/plaintextaccounting/comments/1arkzfg/can_hledger_import_use_account_mappings_from/)
* * *
This is a companion discussion topic for the original entry at [https://www.reddit.com/r/plaintextaccounting/comments/1arkzfg/can\_hledger\_import\_use\_account\_mappings\_from/](https://www.reddit.com/r/plaintextaccounting/comments/1arkzfg/can_hledger_import_use_account_mappings_from/)
