| 1 |
nino.borges |
644 |
"""
|
| 2 |
|
|
LedgerFromCSV
|
| 3 |
|
|
|
| 4 |
|
|
Created by
|
| 5 |
|
|
Emanuel Borges
|
| 6 |
|
|
11.28.2017
|
| 7 |
|
|
|
| 8 |
|
|
This will simply convert a CSV, fixed by us and from numbers, to something that I can then save into the Journal file
|
| 9 |
|
|
|
| 10 |
|
|
"""
|
| 11 |
|
|
|
| 12 |
|
|
import os,csv
|
| 13 |
|
|
|
| 14 |
|
|
|
| 15 |
|
|
if __name__ == '__main__':
|
| 16 |
|
|
mainPath = '/home/nino/Dropbox/Documents/Finance/WithMay/To-do'
|
| 17 |
|
|
mainCSV = 'Done 8.csv'
|
| 18 |
|
|
|
| 19 |
|
|
outputFile = open(os.path.join(mainPath,"DoneLedger.txt"),'w')
|
| 20 |
|
|
#contents = open(os.path.join(mainPath,mainCSV)).readlines()
|
| 21 |
|
|
## Removing headder row
|
| 22 |
|
|
#contents = contents[1:]
|
| 23 |
|
|
with open(os.path.join(mainPath,mainCSV), 'rb') as csvfile:
|
| 24 |
|
|
reader = csv.DictReader(csvfile)
|
| 25 |
|
|
for row in reader:
|
| 26 |
|
|
outputFile.write(row['Posted_Date']+ " "+row['Payee'] + "\n")
|
| 27 |
|
|
outputFile.write(" "+row['Category']+ " "+row['Amount']+ "\n")
|
| 28 |
|
|
outputFile.write(" Liabilities:Personal Visa"+"\n\n")
|
| 29 |
|
|
outputFile.close()
|
| 30 |
|
|
|
| 31 |
|
|
|
| 32 |
|
|
|