From 854f26512ababb0beb99bd814d647039fcf93c9a Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 12 Jan 2014 17:03:33 -0800 Subject: [PATCH] clarify CSV how-to --- doc/CSV.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/doc/CSV.md b/doc/CSV.md index 2b7b8e8f6..58a67b819 100644 --- a/doc/CSV.md +++ b/doc/CSV.md @@ -10,20 +10,23 @@ Say we have downloaded `checking.csv` from a bank for the first time: We could create `checking.csv.rules` containing: - account1 assets:bank:checking - skip 1 - fields date, description, amount - currency $ + # skip the first CSV line (headings) + skip 1 - if ~ SAVINGS - account2 assets:bank:savings + # use the first three fields in each CSV record as transaction date, description and amount respectively + fields date, description, amount + + # prepend $ to CSV amounts + currency $ + + # always set the first account to assets:bank:checking + account1 assets:bank:checking + + # if the CSV record contains ‘SAVINGS’, set the second account to assets:bank:savings + # (if not set, it will be expenses:unknown or income:unknown) + if ~ SAVINGS + account2 assets:bank:savings -This says: -"always use assets:bank:checking as the first account; -ignore the first line; -use the first, second and third CSV fields as the entry date, description and amount respectively; -always prepend $ to the amount value; -if the CSV record contains 'SAVINGS', use assets:bank:savings as the second account". [CSV files](MANUAL.html#csv-files) in the manual describes the syntax. Now hledger can read this CSV file: