Import Apps

Questa documentazione è superata

La documentazione più completa e aggiornata è quella di Banana Contabilità Plus: Provalo subito

In this article

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

Import Apps

Imports apps are java-script program that read the data to import and trasform and return them as text, in a format comptatible with Banana.

Import Apps have the

  • attribute @task defined as one of the import for example //@task = import.transactions
  • 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 retrun statement
// @api = 1.0
// @id = ch.banana.scripts.import.creditsuisse
// @description = Credit Suisse bank (*.csv)
// @task = import.transactions
// @doctype = nodocument
// @publisher = Banana.ch SA
// @pubdate = 2015-06-21
// @outputformat = transactions.simple
// @inputdatasource = openfiledialog
// @inputfilefilter = Text files (*.txt *.csv);;All files (*.*)
// @inputfilefilter.de = Text (*.txt *.csv);;Alle Dateien (*.*)
// @inputfilefilter.fr = Texte (*.txt *.csv);;Tous (*.*)
// @inputfilefilter.it = 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
  // int the return text the data is tab separated
  var outText = "Date\tDescription\tAmount\n";
  outText += "2015-01-31\tExpense text\t100.25\n";  
  return outText;
}

Condividi questo articolo: Twitter | Facebook | LinkedIn | Email