Assigning account categories to bank transactions #1003
pjfarleyiii
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Nice, @pjfarleyiii !! :D |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is as simple an example as I could manage to set up to show how to match a CSV of bank transactions to a much smaller CSV of Payee_Name and Account_Category. The original goal was to process a CSV of years of bank transactions to add an accounting category to each transaction for eventual input to a checkbook program like KMyMoney or Quicken where reports by account category can help manage a budget.
Note that the example input transaction with $Name == "CON EDISON" does NOT have a matching entry in the name-to-category file. As time goes by, there will be new "Name" values in the input bank transaction file and they need to have a non-blank Category value, so I assign the category "Uncategorized" to any line where the Category field is not populated after the join is completed.
The "Starting / Ending Balance" lines in the input transaction file DO have a Category value, but in order to get the Category from the name-to-category input file into the final result I found that I had to first cut the original "Category" field from the input. I could not figure out how to get a join to keep an original non-empty value of Category but assign a new category value when the input transaction Category is empty.
The resulting Miller command line looks complex but it works, which is what counts.
I hope this helps anyone with a similar requirement.
Input Name to Category CSV (bankcats.csv):
Input sample bank transaction file (banktrans.csv):
Miller command to add the category value to the transactions base on the Name field:
Output of the Miller command (bankjoin.csv):
Beta Was this translation helpful? Give feedback.
All reactions