Import Extensions

In dit artikel

Import Extensions read a custom format and convert in an import format suitable for using with the command "Import to accounting".

Import Extensions

Imports Extensions are JavaScript program that read the data to import and transform and return them as text, in a format compatible with Banana.

Import BananaApps have:

  • the attribute @task defined as one of the import for example //@task = import.transactions (for more information, see Apps attributes documentation)
  • 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
// @api = 1.0
// @id = ch.banana.scripts.import.creditsuisse
// @description = Credit Suisse bank (*.csv)
// @task = import.transactions
// @doctype = nodocument
// @publisher = SA
// @pubdate = 2015-06-21
// @outputformat = transactions.simple
// @inputdatasource = openfiledialog
// @inputfilefilter = Text files (*.txt *.csv);;All files (*.*)
// = Text (*.txt *.csv);;Alle Dateien (*.*)
// = Texte (*.txt *.csv);;Tous (*.*)
// = Testo (*.txt *.csv);;Tutti i files (*.*)

* Parse the data and return the data to be imported as a tab separated file.
function exec(inText) {
  // parse the inText and set to outText
  // in the return text the data is tab separated
  var outText = "";
  outText += "Date\tDescription\tIncome\tExpenses\n";
  outText += "2015-01-01\tIncome text\t100.25\t\n";
  outText += "2015-01-02\tExpense text\t\t73.50\n";  
  return outText;

Help ons de documentatie te verbeteren

We horen graag uw feedback over hoe we deze pagina kunnen verbeteren.

Vertel ons welk thema een betere uitleg nodig heeft of hoe we een onderwerp kunnen verduidelijken.

Share this article: Twitter | Facebook | LinkedIn | Email