Skip to content

Commit 30a57e3

Browse files
authored
Merge pull request #4 from u2berggeist/write_Accounts
Write accounts
2 parents 6ab8d6c + fcb1df8 commit 30a57e3

File tree

5 files changed

+22
-4
lines changed

5 files changed

+22
-4
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ transactions_test.csv
33
test
44
**/test.gnucash.2*
55
csv2cash/__pycache__
6-
personal.py
6+
personal.py
7+
accountlist.txt
8+
*rope*

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"python.pythonPath": "C:\\ProgramData\\Anaconda3\\python.exe",
2+
"python.pythonPath": "C:\\tools\\miniconda3\\python.exe",
33
"cSpell.words": [
44
"duplicatetf",
55
"iterrows"

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Unreleased
44

5+
## 0.2.3 - 2018-07-01
6+
7+
### Added
8+
- `write_account_list` was added. This will write the fullname of accounts listed in GNUCash book
9+
510
## 0.2.2 - 2018-06-18
611

712
### Added

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ In Mint for example, if you export a CSV of all your transfer data, it will keep
1010
### Translates your CSV categories into a GNUCash account
1111
Say your CSV has a category system attached to each transfer and you want that organization to be transferred into Mint without having to go one-by-one through every transfer and label them. This will do that by setting up the `translation.json` dictionary, which will take a transfer that is under a given category, and place it in the corresponding GNUCash account.
1212

13-
Use the `get_uncat_transfers` function to view any transactions that haven't been categorized. This can be useful to determine what translations you still need to add to `translationS.json`.
13+
Use the `get_uncat_transfers` function to view any transactions that haven't been categorized. This can be useful to determine what translations you still need to add to `translations.json`. You can also use `write_account_list` to create a text file of all the accounts in a GNUCash book, this way you don't have to keep your GNUCash book open the whole time!
1414

1515
## How to Use:
1616
### 1. Make your inputs
1717
There is a section in the `main.py` script called `INPUTS`. Here you will enter in the path to the CSV of your raw transfer data, the GNUCash book you want to edit, and the translation JSON.
1818

19-
You should already have filled out the `translation.json` at this point. Use the `get_uncat_transfers` function to view any transactions that haven't been categorized. This can be useful to determine what translations you still need to add to `translationS.json`.
19+
You should already have filled out the `translation.json` at this point. Use the `get_uncat_transfers` function to view any transactions that haven't been categorized. This can be useful to determine what translations you still need to add to `translations.json`.
2020

2121
### 1.5 Run `get_compiled_transactions`
2222
I recommend doing this to make sure that all the transactions look ok. I recommend using `dfgui` as a way to view the DataFrames to make sure everything is looking right.

csv2cash/main.py

+11
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ def get_uncat_transfers(path_to_rawdata, path_to_translationJSON):
4141

4242
return(rawdata.loc[(rawdata['category_mod'] == 'Uncategorized')])
4343

44+
def write_account_list(path_to_Book, path_to_accountlistfile):
45+
""" Write list of accounts in book to a text file"""
46+
book = piecash.open_book(path_to_Book.as_posix())
47+
48+
accountstr = ""
49+
for account in book.accounts:
50+
accountstr += account.fullname
51+
accountstr += '\n'
52+
53+
path_to_accountlistfile.write_text(accountstr)
54+
4455

4556
##########################################################################
4657
#----GETTING DATA------

0 commit comments

Comments
 (0)