hledger/examples/sample.csv.rules

38 lines
964 B
Plaintext
Raw Normal View History

2019-01-06 09:39:55 +03:00
# hledger csv conversion rules for sample.csv
# skip the headings line:
skip 1
2019-01-06 09:39:55 +03:00
# use the first three CSV fields for hledger's transaction date, description and amount:
2019-01-06 09:39:55 +03:00
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
2019-01-06 09:39:55 +03:00
# set account2 to this:
# account2 Revenues:Misc
2019-01-06 09:39:55 +03:00
# change it to Expenses:Misc if the csv "amount" field contains a minus sign:
# if %amount -
# account2 Expenses:Misc
2019-01-06 09:39:55 +03:00
# 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:
2019-01-06 09:39:55 +03:00
if (TO|FROM) SAVINGS
account2 assets:bank:savings
if WHOLE FOODS
account2 expenses:food