ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Ledger/LedgerFromCSV.py
Revision: 770
Committed: Mon Jul 18 22:56:37 2022 UTC (3 years, 8 months ago) by nino.borges
Content type: text/x-python
File size: 1090 byte(s)
Log Message:
cleaned up the code so that it marks it as cleared by default and upated paths.

File Contents

# Content
1 """
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 fileNumber = '202205'
17
18
19 mainPath = '/home/nino/Nextcloud/Nino And May/Fin/Amanda To-Do/_Ready'
20 mainCSV = 'Done-%s.csv'%fileNumber
21
22 outputFile = open(os.path.join(mainPath,"DoneLedger%s.txt"% fileNumber),'w')
23 #contents = open(os.path.join(mainPath,mainCSV)).readlines()
24 ## Removing headder row
25 #contents = contents[1:]
26 with open(os.path.join(mainPath,mainCSV), 'rt', encoding='ASCII') as csvfile:
27 reader = csv.DictReader(csvfile)
28 for row in reader:
29 outputFile.write(row['Posted_Date']+ " * "+row['Payee'] + "\n")
30 if row['Other_Notes']:
31 outputFile.write(" ; " + row['Other_Notes'] + "\n")
32 outputFile.write(" "+row['Category']+ " "+row['Amount']+ "\n")
33 outputFile.write(" Liabilities:Personal Visa"+"\n\n")
34 outputFile.close()