-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbank-parse.nu
More file actions
40 lines (37 loc) · 1.14 KB
/
bank-parse.nu
File metadata and controls
40 lines (37 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/env nu
# Parse some banks' CSV formats
# Common output has columns: date, description, type, amount, category, account
# Parse chase bank CSV files
# expected input is: `open <filename>.csv --raw`
export def "from chase-bank" [] {
from csv |
update "Transaction Date" { || into datetime } |
flatten |
rename -c {"Transaction Date": "date"} |
rename -b { || str trim | str downcase } |
select date description category type amount |
insert account "chase"
}
# Parse ally bank CSV files
# expected input is: `open <filename>.csv --raw`
export def "from ally-bank" [] {
from csv |
update Date { || into datetime } |
flatten |
rename -b { || str trim | str downcase } |
select date description type amount |
insert category "" |
insert account "ally"
}
# Parse wells fargo bank CSV files
# expected input is: `open <filename>.csv --raw`
export def "from wells-fargo-bank" [] {
from csv --noheaders |
rename date amount _ _ description |
reject _ |
update date { || into datetime } |
flatten |
insert category "" |
insert type "" |
insert account "wells fargo"
}