Created
July 18, 2015 18:13
-
-
Save katylava/3d80bc58e64d1b306d43 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
1. Copy pending transactions from chase.com | |
2. `pbpaste | path/to/pending2ynab.py > ~/Desktop/ynabimport.csv` | |
3. Import ~/Desktop/ynabimport.csv file into YNAB | |
""" | |
import re | |
import sys | |
from datetime import date | |
print('Date,Payee,Category,Memo,Outflow,Inflow') | |
payee_pattern = re.compile('^(?:POS DEBIT )?(.*) Link .*$') | |
for line in sys.stdin: | |
infields = line.strip().split('\t') | |
payee = payee_pattern.findall(infields[2]) | |
outfields = [ | |
date.today().strftime('%m/%d/%Y'), | |
payee and payee[0], | |
'', | |
'', | |
infields[3].strip(), | |
infields[4].strip(), | |
] | |
print(','.join(outfields)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment