@actual-app/import-ynab5 中文文档教程
这是 YNAB5 (nYNAB) 数据的 beta 导入器。
运行:
npx @actual-app/import-ynab5 <path-to-ynab5-file>
阅读下文了解如何获取 YNAB5 文件。
现在几乎一切都应该正常工作了。
TODO
- There might be a way to set carryover using internal categories from YNAB (Deferred Income Subcategory and Immediate Income Subcategory)
- Docs of how credit cards translate from Actual to YNAB
- Maybe something else I'm missing
- Remove ynab transfer payees not used by actual
How to use the importer
要使用导入器,您首先需要导出预算,然后安装正确的软件,然后运行导入器。
注意:目前这在 Windows 的 WSL 下不起作用。 直接在 Windows 中运行。
Exporting from YNAB
为了从 YNAB 导出预算,您需要一个 API 密钥。
如果您还没有 API 密钥,则需要:
- Sign in to the YNAB web app
- Go to the "Account Settings" page, then to the "Developer Settings" page
- Under the "Personal Access Tokens" section, click "New Token"
- Enter your password and click "Generate" to get a new access token
API 密钥只显示一次,因此请务必将其复制到某个地方! 有关如何访问 YNAB API 的更多信息,请访问 https://api.youneedabudget.com/
现在打开终端窗口/命令提示符,然后输入:
curl -H "Authorization: Bearer <ACCESS_TOKEN>" https://api.youneedabudget.com/v1/budgets
这将获取您拥有的所有预算的列表。 您需要找到要导出的预算的 id
并使用它来执行以下 API 请求:
curl -H "Authorization: Bearer <ACCESS_TOKEN>" https://api.youneedabudget.com/v1/budgets/<BUDGET ID> --output budget.json
Getting the right tools installed
要运行导入程序,您需要安装 nodejs
. 关于此操作的详细信息对于本自述文件来说太长了,但您可以在 https://nodejs.org/ 上找到详细信息。
安装 nodejs
后,您需要下载此导入程序。 如果您熟悉 GitHub 和 Git,那么您可能已经完成了所有设置,可以轻松克隆此存储库。 如果没有,获取此导入程序的最简单方法是使用 Code
按钮,然后使用 Download ZIP
文件。
下载 zip 文件后,将其解压缩到计算机上以提取文件。 然后在终端/命令提示符下,导航到目录并键入命令:
npm i
这将为导入程序安装所需的库。
Running the importer
- Have Actual running locally on your computer
- Open a terminal / command prompt in the unzipped directory from the previous steps
- Run the following command, substituting the
/path/to
with where ever you saved thebudget.json
file:
npx @actual-app/import-ynab5 /path/to/budget.json
如果您已签出此代码并在本地运行它,请执行 node index.js
而不是 npx
命令。
Refresh the cache
导入完成后,可能无法正确显示所有最新信息。 为了刷新视图:
- Click the ⚙️ icon next to the budget name
- Click Advanced -> Reset budget cache
- Restart Actual
Contributions
This is a beta importer for YNAB5 (nYNAB) data.
To run:
npx @actual-app/import-ynab5 <path-to-ynab5-file>
Read below for how to get your YNAB5 file.
Almost everything should be working now.
TODO
- There might be a way to set carryover using internal categories from YNAB (Deferred Income Subcategory and Immediate Income Subcategory)
- Docs of how credit cards translate from Actual to YNAB
- Maybe something else I'm missing
- Remove ynab transfer payees not used by actual
How to use the importer
To use the importer, you will first need to export your budget, then have the correct software installed, and then run the importer.
Note: currently this does not work under WSL in Windows. Run this directly in Windows.
Exporting from YNAB
In order to export your budget from YNAB, you will need an API key.
If you haven't already got an API key, you'll need to:
- Sign in to the YNAB web app
- Go to the "Account Settings" page, then to the "Developer Settings" page
- Under the "Personal Access Tokens" section, click "New Token"
- Enter your password and click "Generate" to get a new access token
The API key is only shown once, so make sure you copy it down somewhere! More information on how to access the YNAB API can be found at https://api.youneedabudget.com/
Now open a terminal window / command prompt, and enter:
curl -H "Authorization: Bearer <ACCESS_TOKEN>" https://api.youneedabudget.com/v1/budgets
This will get the list of all the budgets you have. You'll need to find the id
of the budget you want to export and use it to perform the following API request:
curl -H "Authorization: Bearer <ACCESS_TOKEN>" https://api.youneedabudget.com/v1/budgets/<BUDGET ID> --output budget.json
Getting the right tools installed
For the importer to run, you will need nodejs
installed. Details on doing that are too long for this README, but you can find details at https://nodejs.org/.
Once you have nodejs
installed, you'll need to get download this importer. If you're familiar with GitHub and Git then you probably have everything setup to easily clone this repository. If not, the easiest way to get this importer is to use the Code
button and then use the Download ZIP
file.
Once you have downloaded the zip file, unzip it on your computer to extract the files. Then in a terminal / command prompt, navigate into the directory and type the command:
npm i
This will install the required libraries for the importer.
Running the importer
- Have Actual running locally on your computer
- Open a terminal / command prompt in the unzipped directory from the previous steps
- Run the following command, substituting the
/path/to
with where ever you saved thebudget.json
file:
npx @actual-app/import-ynab5 /path/to/budget.json
If you have checked out this code and running it locally, do node index.js
instead of the npx
command.
Refresh the cache
Once the import is complete, it may not show all the up-to-date information correctly. In order to refresh the view:
- Click the ⚙️ icon next to the budget name
- Click Advanced -> Reset budget cache
- Restart Actual
Contributions
If you would like to contribute, check out the documentation for the API, specifically about importers. All of the available methods can be found here.