Created
September 21, 2015 06:08
-
-
Save manishrjain/c179eecc7763b60f6807 to your computer and use it in GitHub Desktop.
Python code to convert Chase Transactions to YNAB CSV format
This file contains 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/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