actualbudget / import-ynab5 Goto Github PK
View Code? Open in Web Editor NEWA tool for importing YNAB5 (nYNAB) data into Actual
A tool for importing YNAB5 (nYNAB) data into Actual
Importing Accounts...
Importing Categories...
Importing Payees...
Importing Transactions...
TypeError: Cannot read properties of undefined (reading 'id')
at /Users/bzupnick/Desktop/import-ynab5/importer.js:226:14
at Array.map (<anonymous>)
at /Users/bzupnick/Desktop/import-ynab5/importer.js:190:35
at Array.map (<anonymous>)
at importTransactions (/Users/bzupnick/Desktop/import-ynab5/importer.js:187:38)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async doImport (/Users/bzupnick/Desktop/import-ynab5/importer.js:306:3)
at async /Users/bzupnick/Desktop/import-ynab5/node_modules/@actual-app/api/connection.js:113:5
at async _run (/Users/bzupnick/Desktop/import-ynab5/node_modules/@actual-app/api/connection.js:91:11)
at async run (/Users/bzupnick/Desktop/import-ynab5/index.js:6:3)
I'm getting the following error:
$ node index.js YourBudget.json
Importing Accounts...
Importing Categories...
Importing Payees...
Importing Transactions...
Error: [API Error] Can't convert to integer: -3506.9
at /Users/bzupnick/Desktop/import-ynab5/node_modules/@actual-app/api/connection.js:26:13
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /Users/bzupnick/Desktop/import-ynab5/importer.js:242:7
at async Promise.all (index 3)
at async importTransactions (/Users/bzupnick/Desktop/import-ynab5/importer.js:186:3)
at async doImport (/Users/bzupnick/Desktop/import-ynab5/importer.js:306:3)
at async /Users/bzupnick/Desktop/import-ynab5/node_modules/@actual-app/api/connection.js:113:5
at async _run (/Users/bzupnick/Desktop/import-ynab5/node_modules/@actual-app/api/connection.js:91:11)
at async run (/Users/bzupnick/Desktop/import-ynab5/index.js:6:3)
When I open up YourBudget.json
, though, I'm not seeing -3506.9
. I am seeing:
{"id":"cef8382e-c42d-4241-af37-f1909175fb7b","date":"2021-11-05","amount":-35069,"memo":"Market Close","cleared":"cleared","approved":true,"flag_color":null,"account_id":"58543bed-6c70-4074-97ab-1a1c35b17a7d","payee_id":"4c48f4b2-b423-4aac-a898-5a84b3fd94b4","category_id":null,"transfer_account_id":null,"transfer_transaction_id":null,"matched_transaction_id":null,"import_id":null,"deleted":false},
which is the closest I can see to being the "culprit" transaction.
The weird thing is that if, in YNAB, I go to that account on that day I only see a transaction for $35.07 ๐ค
So I tried changing 35069
to 35070
in YourBudget.json
and reran it. I got a similar error but a different number:
Error: [API Error] Can't convert to integer: 184.8
and that's just from the next transaction, as you can see in the screenshot above, that in the GUI says $1.85.
So obviously I fixed that one number again, ran it to confirm, and the third number tripped up. We've found the pattern.
Note that this account is populated twice daily automatically by a Google script I wrote up that creates a YNAB transaction via it's API. Unfortunately I don't have access to that script anymore since Google decided to not open that page:
But I wonder if the issue is that maybe my script is sending numbers like $5.345 or something? That's getting rounded in the GUI, not in the backend, and is screwing with the script here? Since I don't have access to my spreadsheet macros it's hard to debug and give it exactly what's being sent. Sorry!
Hey, this looks like fun. I'm not a "developer" but I think I could handle this. The problem I have is that my experience is mostly in scripting (bash/powershell/etc). How do I get started in testing what I've written?
Have Actual running locally and run `node index.js /path/to/data.json`.
I'm on Windows. Do I need to install node.js or is it included in the Actual files?
I could use a 'prerequisites' section here: https://actualbudget.com/docs/developers/using-the-API/
I'm not a developer so stumbling around a little with this.. can anyone assist me with this error? I've got nodejs installed running latest version, and updated npm. I downloaded the zip file and extracted it to c:\temp, so the files are in c:\temp\import-ynab5-master. From that path I ran npm i in bash to install the libraries.
Then with Actual running, in command prompt, I cd to that directory and run node index.js /budget.json and get 'Error Reading File'. I get the same error if I don't give a file name (node index.js). The budget file I downloaded is in the same directory, so not adding a path to that file name (have also tried putting in the full file path/name, same result).
I have set permissions on the folders to Everyone full access, as well as local machine users (needed to do that to write the file from ynab).
Is anyone able to assist me with this? is it a permissions issue? version issue?
Running W10 latest version.
WLS2
Default node v16.13.0 (have also installed 17.1.0 and running that get same issue)
npm version 8.1.3
Any assistance or pointers appreciated.
Directory of C:\Temp\import-ynab5-master
14/11/2021 06:17 PM
.C:\Temp\import-ynab5-master>bash
[user@laptop]:/mnt/c/Temp/import-ynab5-master$ node index.js /budget.json
Error: Error reading file
at importYNAB5 (/mnt/c/Temp/import-ynab5-master/importer.js:319:11)
at run (/mnt/c/Temp/import-ynab5-master/index.js:6:9)
at Object. (/mnt/c/Temp/import-ynab5-master/index.js:9:1)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
[user@laptop]:/mnt/c/Temp/import-ynab5-master$
Trying to get the ID of my budget from the nynab api results in
{"error":{"id":"404.1","name":"not_found","detail":"Invalid URI"}}
I'm getting the following error when importing my exported .json file from ynab5.
node version is v17.0.1 for Windows.
TypeError: Cannot read properties of undefined (reading 'budget')
at importYNAB5 (C:\temp\import\importer.js:329:37)
at run (C:\temp\import\index.js:6:9)
at Object.<anonymous> (C:\temp\import\index.js:9:1)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
PS C:\temp\import>
I get the same error when importing on macOS, using the latest version installed through Brew.
import-ynab5 and my budget file are both located in C:\temp\import
Category Budgeted amounts aren't being updated by the importer.
Is there a bug in actual.setBudgetAmount()?
I can see an amount getting to the call, but the budgeted value doesn't appear to be updating (verified by checking both the final budget file via UI as well as adding a call to actual.getBudgetMonth() after the import.)
Line 284 in 394ca66
Hey @jlongster ! I'm trying to work on this. I can currently import accounts and categories (tho not sorted yet, for some reason) but the issue I'm having is with payees. I can't seem to set transfer_acct. I don't know if there's maybe something wrong with the API or something wrong with my code:
let api = require('@actual-app/api');
const fs = require('fs')
async function run() {
let id = await api.createPayee({
name: "Test - Tarjeta",
transfer_acct: "86cf22d5-3ca1-434f-be14-489032bf3fea"
});
console.log(await api.getPayees());
}
api.runWithBudget('My-Finances-a8f9d08', run);
And the console logs:
D:\Documentos\GitHub\import-ynab5>node test.js
[
{
id: 'cc8010f5-c9f4-47bc-aa9f-cbbc5dd2b50e',
name: 'cablevision',
category: null,
transfer_acct: null
},
{
id: '1b4fb67f-51ea-4408-bf73-7a5243a4bc42',
name: 'Test - Tarjeta',
category: null,
transfer_acct: null
},
{
id: '5b5ef78e-d2ab-40e9-a8c0-2562c33b07b8',
name: 'Efectivo',
category: null,
transfer_acct: '1f9959ad-2725-4dc1-b67f-b800d9a64883'
},
{
id: '041e8dda-8a0e-4d75-975a-98e4080749d6',
name: 'Tarjeta',
category: null,
transfer_acct: '86cf22d5-3ca1-434f-be14-489032bf3fea'
}
]
Any help would be awesome. Thanks!
Thinking about this repo's TODO around imported bank transactions ids.
API docs say imported_id
is
A unique id usually given by the bank, if importing. Use this is avoid duplicate transactions.
Can anyone confirm or deny that YNAB import_id
could be safely mapped to Actual imported_id
?
YNAB import_id
s look like YNAB:-127850:2021-11-08:1
, which feels generated by YNAB rather than "given by the bank", but also feels adequately unique to use in avoiding duplicates.
I withdraw cash while buying at the supermarket, which is a transfer to my purse (on-budget cash account).
The "Everyday" payment account has a split transaction, $24.19 groceries, $40 transfer.
This imports to Actual as $24.19 groceries, and $40 category needed.
The "Purse" account, has this transaction listed as a Transfer of $40 from the "Everyday" account. (This is accurate.)
My question is: how to fix/categorise the transfer transaction in the "Everyday" account?
To do a transfer I would have to change the split transaction into 2 transactions, I think.
I am guessing:
(1) change the split into 2 transactions, so one can be a transfer;
(2) delete the transaction already in the 'purse' account in favour of the new transaction the new transfer has created.
This is historical, obviously, but I would like to make sure I don't mess my history up as I start out in Actual.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.