In diesem Artikel
Most software or online banking can only export data in a proprietary format that Banana Accounting cannot understand.
For this cases it is possible to create an Import Extension that that converts data from a proprietary format to a format that is accepted by Banana.
Import Extensions read a custom format and convert in an import format suitable for using with the command "Import to accounting".
- Import extension for Bank Statements
- Extension for importing transactions
- For examples see the Github.com template page.
Create an Import Extensions for converting from other formats
The Import Extensions can be used within the Command Action->Import into Accounting.
Extension Attributes
An Import extension has the Extension attribute @task of type "import.":
- import.accounts
See the format specified in: Import Accounts. - import.categories
- import.vatcodes
- import.transaction
When importing transaction you can set the @outputformat- tablewithheaders
will take the columns exactly as in the Transactions table, that varies depending on the account type.
For double entry transaction see: Import Double-entry transactions in CSV format. - transactions.simple
Will take the format that is typical for a bank account statement.
See: Import Income & Expenses transactions in CSV format.
- tablewithheaders
exec() function
Banana load an extension and call the Exec(inText) function of an Import Extention:
- The exec( inText) the argument receive the row data that is read from the file or clipboard.
- The exec() function should return a value that contains the converted data that is to be imported. It can be of type:
- TSV (Tab separated Value)
- The first line should contains the column names.
Columns names varies dependent on the table or functionality.
See Import data from a txt file. - The other lines should contain the data to be imported.
- The first line should contains the column names.
- JSon in the the DocumentChange API Format.
- TSV (Tab separated Value)
Convert to a tab separated text
Imports Extensions are JavaScript program that import data to a specific table.
The import with tab separated text only allow to add rows to a table:
Import Extensions have:
- the attribute @task defined as one of the import for example //@task = import.transactions (for more information, see Apps attributes documentation)
- the attribute @outputformat defines the format of the imported data:
- For a Double-entry accounting use the value //@outputformat = tablewithheaders.
- For an Income/Expenses accounting use the value //@outputformat = transactions.simple.
- The parameter in the function exec contains the import data (the content of the file specified in the input box)
- You can specify that the data is read from the file specified on the input box or that the user can select the file with "// @inputdatasource = openfiledialog"
- The import text is returned as a String in the function exec with the return statement
Import with DocumentChange
You can directly import the data into accounting using the DocumentChange API. Parse the information, define the changes to be made to the document and return the JSON Object.
With the DocumentChange API you can add, modify or remove line from any tables. You can also add or modify columns.