Skip to content

Instantly share code, notes, and snippets.

@manishrjain
Created September 21, 2015 06:08
Show Gist options
  • Save manishrjain/c179eecc7763b60f6807 to your computer and use it in GitHub Desktop.
Save manishrjain/c179eecc7763b60f6807 to your computer and use it in GitHub Desktop.
Python code to convert Chase Transactions to YNAB CSV format
#!/usr/bin/python
import sys
f = open(sys.argv[1])
print "Date,Payee,Category,Memo,Outflow,Inflow"
for l in f.readlines():
a = l.strip().split(',')
p = 0
try:
p = float(a[4]) * 1.4 # USD to AUD
except ValueError:
continue
outflow = 0.0
inflow = 0.0
if p > 0:
inflow = p
elif p == 0:
continue
else:
outflow = 0-p
print "%s,%s,,,%.2f,%.2f" % (a[2],a[3],outflow,inflow)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment