Implement Export in YNAB-Format #15
@ -47,7 +47,10 @@ func (ynab *YNABExport) ExportAssignments(context context.Context, w io.Writer)
|
|||||||
"0,00€",
|
"0,00€",
|
||||||
}
|
}
|
||||||
|
|
||||||
csv.Write(row)
|
err := csv.Write(row)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("write assignment: %w", err)
|
||||||
|
}
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
csv.Flush()
|
csv.Flush()
|
||||||
@ -59,7 +62,7 @@ func (ynab *YNABExport) ExportAssignments(context context.Context, w io.Writer)
|
|||||||
|
|
||||||
// ImportTransactions expects a TSV-file as exported by YNAB in the following format:
|
// ImportTransactions expects a TSV-file as exported by YNAB in the following format:
|
||||||
// "Account" "Flag" "Date" "Payee" "Category Group/Category" "Category Group" "Category" "Memo" "Outflow" "Inflow" "Cleared"
|
// "Account" "Flag" "Date" "Payee" "Category Group/Category" "Category Group" "Category" "Memo" "Outflow" "Inflow" "Cleared"
|
||||||
// "Cash" "" "11.12.2021" "Transfer : Checking" "" "" "" "Brought to bank" 500,00€ 0,00€ "Cleared"
|
// "Cash" "" "11.12.2021" "Transfer : Checking" "" "" "" "Brought to bank" 500,00€ 0,00€ "Cleared".
|
||||||
func (ynab *YNABExport) ExportTransactions(context context.Context, w io.Writer) error {
|
func (ynab *YNABExport) ExportTransactions(context context.Context, w io.Writer) error {
|
||||||
csv := csv.NewWriter(w)
|
csv := csv.NewWriter(w)
|
||||||
csv.Comma = '\t'
|
csv.Comma = '\t'
|
||||||
@ -90,7 +93,10 @@ func (ynab *YNABExport) ExportTransactions(context context.Context, w io.Writer)
|
|||||||
|
|
||||||
row = append(row, string(transaction.Status))
|
row = append(row, string(transaction.Status))
|
||||||
|
|
||||||
csv.Write(row)
|
err := csv.Write(row)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("write transaction: %w", err)
|
||||||
|
}
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ type Transfer struct {
|
|||||||
|
|
||||||
// ImportTransactions expects a TSV-file as exported by YNAB in the following format:
|
// ImportTransactions expects a TSV-file as exported by YNAB in the following format:
|
||||||
// "Account" "Flag" "Date" "Payee" "Category Group/Category" "Category Group" "Category" "Memo" "Outflow" "Inflow" "Cleared"
|
// "Account" "Flag" "Date" "Payee" "Category Group/Category" "Category Group" "Category" "Memo" "Outflow" "Inflow" "Cleared"
|
||||||
// "Cash" "" "11.12.2021" "Transfer : Checking" "" "" "" "Brought to bank" 500,00€ 0,00€ "Cleared"
|
// "Cash" "" "11.12.2021" "Transfer : Checking" "" "" "" "Brought to bank" 500,00€ 0,00€ "Cleared".
|
||||||
func (ynab *YNABImport) ImportTransactions(context context.Context, r io.Reader) error {
|
func (ynab *YNABImport) ImportTransactions(context context.Context, r io.Reader) error {
|
||||||
csv := csv.NewReader(r)
|
csv := csv.NewReader(r)
|
||||||
csv.Comma = '\t'
|
csv.Comma = '\t'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user