mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-10 05:39:31 +03:00
38 lines
964 B
Plaintext
38 lines
964 B
Plaintext
# hledger csv conversion rules for sample.csv
|
|
|
|
# skip the headings line:
|
|
skip 1
|
|
|
|
# use the first three CSV fields for hledger's transaction date, description and amount:
|
|
fields date, description, amount
|
|
|
|
# specify the date field's format - not needed here since date is Y/M/D
|
|
# date-format %-d/%-m/%Y
|
|
# date-format %-m/%-d/%Y
|
|
# date-format %Y-%h-%d
|
|
|
|
# since the CSV amounts have no currency symbol, add one:
|
|
currency $
|
|
|
|
# set the base account that this CSV file corresponds to
|
|
account1 assets:bank:checking
|
|
|
|
|
|
# set account2 to this:
|
|
# account2 Revenues:Misc
|
|
|
|
# change it to Expenses:Misc if the csv "amount" field contains a minus sign:
|
|
# if %amount -
|
|
# account2 Expenses:Misc
|
|
|
|
# override it with more specific rules below...
|
|
|
|
|
|
# the other account will default to expenses:unknown or income:unknown;
|
|
# we can optionally refine it by matching patterns in the CSV record:
|
|
if (TO|FROM) SAVINGS
|
|
account2 assets:bank:savings
|
|
|
|
if WHOLE FOODS
|
|
account2 expenses:food
|