Answering myself there, for the record.

The workflow looks like this:

1) download all csvs from bank into one folder
2) run this makefile
```makefile
%.ledger: %.csv
    sed -i '1d' $<
    # "Date","Payee","Account number","Transaction type","Payment 
reference","Category","Amount (EUR)","Amount (Foreign Currency)","Type 
Foreign Currency","Exchange Rate"
    sed -i '1i date,payee,Account number,Transaction 
type,note,category,amount' $<
    touch main.ledger
    touch empty.ledger
    ledger convert $< --account Assets:my_bank_csv --rich-data --invert -f 
empty.ledger > $@
    echo "add currency to expenses"
    sed -i 's/Expenses.*[0-9]$$/& EUR/' $@
    rm empty.ledger
ledger_files:= $(patsubst %.csv,%.ledger,$(wildcard *.csv))
main.ledger: $(ledger_files)
    find *.ledger -type f -exec cat '{}' \; >> main.ledger.tmp
    echo "Inject our rules in"
    ledger print -f rules.ledger -f main.ledger.tmp > main.ledger
```

then, in rules.ledger, one can inject custom payees, and then accounts too 
for entries that are too generic (amazon for example, or paypal)
```
; careful to use "uuid" and not "UUID" here
payee CUSTOM Amazon 9fa2b323d58d031afe7b776c5106949acf1
    uuid 9fa2b323d58d031afe7b776c5106949acf1

account Expenses:House:Fixing Materials
    payee ^CUSTOM Amazon 9fa2b323d58d031afe7b776c5106949acf1
```
On Tuesday, February 5, 2019 at 10:22:56 AM UTC+1 Matthieu Talbot wrote:

> Hello,
> New user here :) I have hacked some bash to convert the bank csv to a 
> ledger csv on which I run "convert" and store the result in an "imported 
> folder". Then in my main ledger file, I include every file from the 
> imported folder. Now, some transactions need more fine tuning for example 
> health ones, for which I pay a certain amount but will be reimbursed by the 
> assurance later (if I got it correctly, the expense should be split into an 
> asset:reimbursable and a later transaction will balance it). How can I 
> specify a transaction from a different file? I tried to use uuid but the 
> difference makes ledger stop so that's not the good approach. How do you 
> manager this situation? :) best, Matthieu 
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/ade704d9-ebee-4aa6-83a2-fba0d4579992n%40googlegroups.com.

Reply via email to