Packages

Convert YNAB CSV exports into files that hledger can read.

Current section

Files

Jump to
de_ynab hl-register.csv.rules
Raw

hl-register.csv.rules

skip 0

# YNAB's color Flag (column 2) is skipped here: DeYnab.put_flag_comment/1 adds it to the
# memo as a `flag: <color>` tag, which shows up in the transaction comment below
fields account1,_,code,date,payee,category,mastercategory,subcategory,memo,outflow,inflow,cleared, _,amount,status,budgetaccount,budgetamount,budgetcomment,counteraccount,incomecomment,split1account,split1amount,split1comment,split2account,split2amount,split2comment,split3account,split3amount,split3comment,split4account,split4amount,split4comment,split5account,split5amount,split5comment,split6account,split6amount,split6comment,split7account,split7amount,split7comment,split8account,split8amount,split8comment,split9account,split9amount,split9comment,split10account,split10amount,split10comment,split11account,split11amount,split11comment,split12account,split12amount,split12comment,split13account,split13amount,split13comment,split14account,split14amount,split14comment,split15account,split15amount,split15comment,split16account,split16amount,split16comment,split17account,split17amount,split17comment,split18account,split18amount,split18comment,split19account,split19amount,split19comment,split20account,split20amount,split20comment

#newest-first

description  %payee
comment      %memo
account2     Expenses:%mastercategory:%subcategory
# the date format here must match how YNAB exported the dates; the Elixir side's
# :date_format setting (used for the income posting dates) must agree with it
date-format  %m/%d/%Y

# the currency symbol is carried in the CSV data itself (set the one used in the
# output with config :de_ynab, currency_symbol:)
amount       %14

# if ITUNES
#  account2 expenses:entertainment

# if (TO|FROM) SAVINGS
#  account2 assets:bank:savings
if Income:
 account2     Revenue:income:%payee

# this requires the Elixir remapper to run on the category column
if Transfer :
 account2     %category

# Transfers with a budget Category get a virtual posting in the same transaction
# (see DeYnab.set_transfer_category/1)
if %budgetaccount .
 account3     %budgetaccount
 amount3      %budgetamount
 comment3     %budgetcomment

if Pre-YNAB Debt
 account2     Equity:starting balances

if Starting Balance
 account2     Equity:starting balances

# Rows YNAB left without a Category get their other account picked by
# DeYnab.put_counter_account/1
if %counteraccount .
 account2     %counteraccount

# "Income:Available next month" gets a posting date (first of next month) on the Revenue
# posting; see DeYnab.put_income_comment/1
if %incomecomment .
 comment2     %incomecomment

# Split transactions are merged into one row by DeYnab.group_splits/1: the split postings
# become account2..account21 (this must come last so it overrides the account2 rules above)
if %split1account .
 account2     %split1account
 amount2      %split1amount
 comment2     %split1comment

if %split2account .
 account3     %split2account
 amount3      %split2amount
 comment3     %split2comment

if %split3account .
 account4     %split3account
 amount4      %split3amount
 comment4     %split3comment

if %split4account .
 account5     %split4account
 amount5      %split4amount
 comment5     %split4comment

if %split5account .
 account6     %split5account
 amount6      %split5amount
 comment6     %split5comment

if %split6account .
 account7     %split6account
 amount7      %split6amount
 comment7     %split6comment

if %split7account .
 account8     %split7account
 amount8      %split7amount
 comment8     %split7comment

if %split8account .
 account9     %split8account
 amount9      %split8amount
 comment9     %split8comment

if %split9account .
 account10     %split9account
 amount10      %split9amount
 comment10     %split9comment

if %split10account .
 account11     %split10account
 amount11      %split10amount
 comment11     %split10comment

if %split11account .
 account12     %split11account
 amount12      %split11amount
 comment12     %split11comment

if %split12account .
 account13     %split12account
 amount13      %split12amount
 comment13     %split12comment

if %split13account .
 account14     %split13account
 amount14      %split13amount
 comment14     %split13comment

if %split14account .
 account15     %split14account
 amount15      %split14amount
 comment15     %split14comment

if %split15account .
 account16     %split15account
 amount16      %split15amount
 comment16     %split15comment

if %split16account .
 account17     %split16account
 amount17      %split16amount
 comment17     %split16comment

if %split17account .
 account18     %split17account
 amount18      %split17amount
 comment18     %split17comment

if %split18account .
 account19     %split18account
 amount19      %split18amount
 comment19     %split18comment

if %split19account .
 account20     %split19account
 amount20      %split19amount
 comment20     %split19comment

if %split20account .
 account21     %split20account
 amount21      %split20amount
 comment21     %split20comment

# add ordering / defaults to the results ledger file:
#
# account Assets         ; type: Asset
# account Assets:Banks   ; type: Cash
# account Liabilities
# account Revenue
# account Expenses
# account Expenses:Giving
# account Expenses:Monthly Bills
# account Expenses:Everyday
# account Expenses:Transporation / Auto
# account Expenses:Education
# account Expenses:Entertainment
# account Expenses:Hobbies
# account Expenses:Special Events
# account Expenses:Rainy Day Savings
# account Expenses:Business
# account Expenses:Debt
# account Expenses:Pre-YNAB Debt
# account Expenses:Persons
# account Equity

# ; commodity-less amounts should be treated as dollars
# ; (and displayed with the dollar sign on the left, thousands separators and two decimal places)
# D $1,000.00