actualbudget / import-ynab5

A tool for importing YNAB5 (nYNAB) data into Actual
26 stars 14 forks source link

Set imported transaction IDs #19

Closed trevdor closed 2 years ago

trevdor commented 2 years ago

Answering my own question from #12.

Can anyone confirm or deny that YNAB import_id could be safely mapped to Actual imported_id?

I believe that mapping is safe. I've implemented it in this tiny PR.

From YNAB's API docs:

import_id If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1’. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2’.

So whether your transactions were imported via file, YNAB auto-import, or via API some other way, import_id is the only property a YNAB transaction has for holding a unique ID generated by YNAB or the bank.

jlongster commented 2 years ago

Awesome thank you!