summaryrefslogtreecommitdiff
path: root/schools-cc-importer.py
blob: 0741d3bc48c298485578634dff6f816ce92b017f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import csv
from datetime import datetime
with open('transactions.CSV', newline='') as csvfile:
    with open("temp-trans-out.txt", "w") as output:
        trans = csv.reader(csvfile, delimiter=',', quotechar='|')
        for t in trans:
            dt = datetime.strptime(t[0], '%m/%d/%Y')
            dt = dt.strftime("%Y-%m-%d")
            line = '%s * "%s"\n  Liabilities:SchoolsFirst:Card         -%s USD\n  Expenses:Misc:Amazon                  %s USD\n\n' % (dt, t[1], t[5], t[5])
            output.write(line)
        output.close()
    csvfile.close()