extra: add a bunch of CSV rules examples
This commit is contained in:
		
							parent
							
								
									b322ba995c
								
							
						
					
					
						commit
						99b13544df
					
				
							
								
								
									
										3
									
								
								extra/csv-rules/README
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								extra/csv-rules/README
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | ||||
| Some examples of recent and older CSV rules files, working and | ||||
| otherwise, which should give some ideas. | ||||
| http://hledger.org/manual.html#csv-format describes the format. | ||||
							
								
								
									
										31
									
								
								extra/csv-rules/amazon.csv.rules
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								extra/csv-rules/amazon.csv.rules
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,31 @@ | ||||
| # sample of CSV being converted | ||||
| # "Date","Type","To/From","Name","Status","Amount","Fees","Transaction ID" | ||||
| # "Oct 28, 2012","Payment","To","Adapteva, Inc.","Completed","$25.00","$0.00","17AL58JSK6RPD4HDGLNJPQI1PB98NDKPVHL" | ||||
| #  1              2         3    4                5           6        7       8 | ||||
| 
 | ||||
| # skip the header line | ||||
| skip: 1 | ||||
| 
 | ||||
| # name the csv fields, and assign some of them as entry fields | ||||
| fields: date, type, toorfrom, name, status_, payment, fees, code | ||||
| 
 | ||||
| # parse the date | ||||
| date-format: %b %-d, %Y | ||||
| 
 | ||||
| # combine these fields as the description | ||||
| description: %toorfrom %name | ||||
| 
 | ||||
| # save these fields as tags | ||||
| comment:     status:%status_, fees:%fees | ||||
| 
 | ||||
| # flip the sign on the payment amount | ||||
| amount:      -%payment | ||||
| 
 | ||||
| # set the base account for all txns | ||||
| account1:    assets:personal:online:amazon | ||||
| 
 | ||||
| # set a more specific account2 for txns matching these patterns: | ||||
| 
 | ||||
| #if INTEREST PAYMENT | ||||
| # account2:  revenues:personal:interest | ||||
| 
 | ||||
							
								
								
									
										29
									
								
								extra/csv-rules/bankofireland-checking.csv.rules
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								extra/csv-rules/bankofireland-checking.csv.rules
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,29 @@ | ||||
| # hledger csv conversion rules for bank of ireland | ||||
| 
 | ||||
| # sample of CSV being converted | ||||
| # Date,Details,Debit,Credit,Balance | ||||
| # 07/12/2012,LODGMENT       529898,,10.0,131.21 | ||||
| # 07/12/2012,PAYMENT,5,,126 | ||||
| # 1    2       3     4      5  | ||||
| 
 | ||||
| # skip the header line | ||||
| skip | ||||
| 
 | ||||
| # name the csv fields, and assign some of them as journal entry fields | ||||
| fields  date, description, amount-out, amount-in, balance | ||||
| 
 | ||||
| # date is in UK/Ireland format | ||||
| date-format  %d/%m/%Y | ||||
| 
 | ||||
| # set the currency | ||||
| currency  EUR | ||||
| 
 | ||||
| # set the base account for all txns | ||||
| account1  assets:personal:bank:bank of ireland:checking | ||||
| 
 | ||||
| # alternative way of handling two amount fields: | ||||
| # use one field by default, if it's empty override with the other | ||||
| # amount  -%3 | ||||
| # if ~ | ||||
| # ^[^,]*,[^,]*,, | ||||
| #  amount  %4 | ||||
							
								
								
									
										12
									
								
								extra/csv-rules/eternity.csv.rules
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								extra/csv-rules/eternity.csv.rules
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| # hledger CSV conversion rules for the Eternity iphone app's emailed time log report | ||||
| # cf http://hledger.org/MANUAL.html#convert | ||||
| 
 | ||||
| base-account assets:personal:time | ||||
| date-field 0 | ||||
| date-format %-m/%-d/%y | ||||
| amount-field 3 | ||||
| account2-field 5 | ||||
| description-field %(4)%(5) - %(6) | ||||
| 
 | ||||
| .* | ||||
| expenses:personal:time | ||||
							
								
								
									
										19
									
								
								extra/csv-rules/mint-wellsfargo-checking.csv.rules
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										19
									
								
								extra/csv-rules/mint-wellsfargo-checking.csv.rules
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,19 @@ | ||||
| # hledger csv conversion rules v2 | ||||
| # mint.com | ||||
| 
 | ||||
| account1 assets:personal:bank:wells fargo:checking | ||||
| 
 | ||||
| # 0      1             2                      3        4                  5          6              7        8 | ||||
| #"Date","Description","Original Description","Amount","Transaction Type","Category","Account Name","Labels","Notes" | ||||
| fields date, shortdesc, origdesc, amount, txntype, category, account, labels, notes | ||||
| date-format %-m/%-d/%Y | ||||
| skip 1 | ||||
| currency $ | ||||
| 
 | ||||
| description: %shortdesc - %origdesc %category %account - %txntype | ||||
| 
 | ||||
| account2: expenses:personal:%category | ||||
| 
 | ||||
| if Home Improvement | ||||
|  account2: expenses:personal:home:home care | ||||
| 
 | ||||
							
								
								
									
										25
									
								
								extra/csv-rules/mint.csv.rules
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								extra/csv-rules/mint.csv.rules
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | ||||
| # csv conversion rules file generated by hledger 0.12.98+40 | ||||
| # Add rules to this file for more accurate conversion, see | ||||
| # http://hledger.org/MANUAL.html#convert | ||||
| 
 | ||||
| #mint.com: "Date","Description","Original Description","Amount","Transaction Type","Category","Account Name","Labels","Notes" | ||||
| #fields    "Date","Description","Original Description","Amount","Transaction Type","Category","Account Name","Labels","Notes" | ||||
| #account assets:personal:bank:checking | ||||
| 
 | ||||
| date-field 0 | ||||
| description-field 1 | ||||
| amount-field 3 | ||||
| base-account assets:personal:bank:checking | ||||
| currency $ | ||||
| # | ||||
| # account-assigning rules | ||||
| # | ||||
| # SPECTRUM | ||||
| # expenses:personal:health:gym | ||||
| # | ||||
| # ITUNES | ||||
| # BLKBSTR=BLOCKBUSTER | ||||
| # expenses:personal:entertainment | ||||
| # | ||||
| # (TO|FROM) SAVINGS | ||||
| # assets:personal:bank:savings | ||||
							
								
								
									
										51
									
								
								extra/csv-rules/paypal.csv.rules
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								extra/csv-rules/paypal.csv.rules
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,51 @@ | ||||
| # sample of CSV being converted | ||||
| #Date, Time, Time Zone, Name, Type, Status, Currency, Amount, Receipt ID, Balance,  | ||||
| #"7/20/2009","17:09:22","PDT","Skype","Preapproved Payment Sent","Completed","USD","-10.00","","0.00", | ||||
| 
 | ||||
| # skip the header line | ||||
| skip  1 | ||||
| 
 | ||||
| # name the csv fields, and assign some of them as entry fields | ||||
| fields  date, time, timezone, description, type, status_, currency, grossamount, feeamount, netamount, fromemail, toemail, code, counterpartystatus, etc | ||||
| 
 | ||||
| amount %netamount | ||||
| 
 | ||||
| #if In Progress | ||||
| # skip | ||||
| 
 | ||||
| # date is in US format | ||||
| date-format  %-m/%-d/%Y | ||||
| 
 | ||||
| # save some other fields as tags | ||||
| comment  type:%5, status:%6 | ||||
| 
 | ||||
| # set the base account for all txns | ||||
| account1  assets:personal:online:paypal | ||||
| 
 | ||||
| # conditional blocks | ||||
| 
 | ||||
| # "Update" txns are duplicates, mark them for manual cleanup | ||||
| if | ||||
| Update to  | ||||
|  account2     IGNORE | ||||
|  description  (DELETE) %4 | ||||
|  amount       0 | ||||
| 
 | ||||
| # replace USD currency symbol with $ | ||||
| # matches against the whole record, good enough | ||||
| if | ||||
| ,USD, | ||||
|  currency $ | ||||
| 
 | ||||
| # set a more specific account2 for txns matching these patterns: | ||||
| 
 | ||||
| if | ||||
| INTEREST PAYMENT | ||||
|  account2  revenues:personal:interest | ||||
| 
 | ||||
| if | ||||
| AVAAZ FOUNDATION | ||||
|  account2  expenses:personal:gifts:charity | ||||
| 
 | ||||
| include .common.rules | ||||
| 
 | ||||
							
								
								
									
										10
									
								
								extra/csv-rules/simple.csv.rules
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								extra/csv-rules/simple.csv.rules
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | ||||
| # Date,Recorded at,Scheduled for,Amount,Activity,Pending,Raw description,Description,Category folder,Category,Street address,City,State,Zip,Latitude,Longitude,Memo | ||||
| # 2013/07/24,2013-07-24 08:17:56 AM -0700,,100.00,ACH,false,FUNDS TRANSFER,Funds Transfer,Financial,Money Transfer,,,,,,, | ||||
| 
 | ||||
| account1    assets:personal:bank:simple | ||||
| skip        1 | ||||
| fields      date,recorded_at,scheduled,amount,activity,pending,raw_description,description,category1,category2,,,,,,,comment | ||||
| #date-format %Y-%-m-%-d %T %p %z | ||||
| currency    $ | ||||
| include     .common.rules | ||||
| status      * | ||||
							
								
								
									
										34
									
								
								extra/csv-rules/wellsfargo-checking.csv.rules
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								extra/csv-rules/wellsfargo-checking.csv.rules
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | ||||
| # sample: | ||||
| #"12/04/2009","-12.07","*","","CHECK CRD PURCHASE 12/02 EUPHORIALOVESRAWVOL ..." | ||||
| #"12/04/2009","-789.00","*","2392","CHECK # 2392" | ||||
| # | ||||
| # MCC codes (http://www.irs.gov/irb/2004-31_IRB/ar17.html) are good to match on, eg \?MCC.5812 | ||||
| 
 | ||||
| account1    assets:personal:bank:wf:checking:available | ||||
| skip        0 | ||||
| fields      date,amount,_status,code,description | ||||
| date-format %-m/%-d/%Y | ||||
| currency    $ | ||||
| 
 | ||||
| include     .common.rules | ||||
| 
 | ||||
| #"03/01/2016","-150.00","*","","RECURRING TRANSFER TO ... SAVINGS" | ||||
| if | ||||
| TRANSFER TO.*SAVINGS | ||||
|  account1 assets:personal:bank:wf:checking:month:autosave | ||||
|  account2 assets:personal:bank:wf:savings:prudent reserve | ||||
| 
 | ||||
| if | ||||
| MONTHLY SERVICE FEE | ||||
| ATM TRANSACTION FEE | ||||
| FOREIGN CURR CONV | ||||
| OVERDRAFT TRANSFER FEE | ||||
| BANKING THRU SOFTWARE:FEE | ||||
| INTERNATIONAL PURCHASE TRANSACTION FEE | ||||
| WIRE TRANS SVC CHARGE | ||||
| FEE FOR TRANSFER | ||||
| VISA ISA FEE | ||||
| QUICKEN BANKING | ||||
| NON-WF.*FEE | ||||
| FINANCE CHARGE | ||||
|  account1    assets:personal:bank:wf:checking:available | ||||
							
								
								
									
										13
									
								
								extra/csv-rules/wescom-checking.csv.rules
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								extra/csv-rules/wescom-checking.csv.rules
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| # csv conversion rules file generated by hledger 0.9.1+21 | ||||
| # Add rules to this file for more accurate conversion, see | ||||
| # http://hledger.org/MANUAL.html#convert | ||||
| 
 | ||||
| base-account assets:personal:bank:wescom:checking | ||||
| date-field 0 | ||||
| description-field 1 | ||||
| amount-field 2 | ||||
| #currency $ | ||||
| 
 | ||||
| Share 00 +REGULAR SAVINGS | ||||
| assets:personal:bank:wescom:savings | ||||
| 
 | ||||
							
								
								
									
										28
									
								
								extra/csv-rules/western-checking.csv.rules
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								extra/csv-rules/western-checking.csv.rules
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | ||||
| # western federal credit union checking | ||||
| # 1       2    3      4       5        6           7    8 | ||||
| # account,date,amount,balance,category,description,memo,notes | ||||
| # 000XXXXXXX-S0002,11/16/2012,($19.47),$75.24,Household,AMAZON MKTPLACE PMAMZN.CO AMZN.COM/BILL WA,Date 11/15/12 XXXXXXXX XXXX|Card Withdrawal Debit Card, | ||||
| # memo can be "Date %M/%D/%y %M%D%h%m ...." or some other informative info (Amazon) | ||||
| 
 | ||||
| # ACCOUNT,DATE,AMOUNT,balance,category,DESCRIPTION,memo,notes | ||||
| # account,date,amount,,,description,, | ||||
| 
 | ||||
| skip        1 | ||||
| fields      account,date,amount,balance,category,description,memo,notes | ||||
| date-format %-m/%-d/%Y | ||||
| status      * | ||||
| account1    assets:bank:western federal:checking | ||||
| include     .common.rules | ||||
| 
 | ||||
| # account-field 0 | ||||
| #  0003351165-S0001 = assets:bank:western federal:savings | ||||
| #  0003351165-S0002 = assets:bank:western federal:checking | ||||
| #  0003351165-S0051 = assets:bank:western federal:clubsavings | ||||
| 
 | ||||
| if ~ | ||||
| (To|From) Share 0001 | ||||
|  account2 assets:bank:western federal:savings | ||||
| 
 | ||||
| if ~ | ||||
| (To|From) Share 0051 | ||||
|  account2 assets:bank:western federal:clubsavings | ||||
							
								
								
									
										13
									
								
								extra/csv-rules/ynab-personal-register.csv.rules
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								extra/csv-rules/ynab-personal-register.csv.rules
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| # hledger CSV conversion rules for YNAB 4's register export format | ||||
| 
 | ||||
| account1     assets:personal:ynab | ||||
| 
 | ||||
| # "Account","Flag","Check Number","Date","Payee","Category","Master Category","Sub Category","Memo","Outflow","Inflow","Cleared","Running Balance" | ||||
| fields account,flag,code,date,payee,category,mastercategory,subcategory,memo,outflow,inflow,cleared,balance | ||||
| 
 | ||||
| date-format  %d/%m/%Y | ||||
| description  %payee | ||||
| comment      %memo | ||||
| account2     expenses:personal:%category | ||||
| amount-out   %10 | ||||
| amount-in    %11 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user