Skip to main content

Spanish banks' CSB norm 43 converter to OFX, Homebank, json, yaml, xls, xlsx, ods, csv, tsv

Project description

Español

Herramientas para convertir ficheros en formato usado por múltiples bancos españoles (norma 43 del Consejo Superior Bancario [CSB43] / Asociación Española de Banca [AEB43]) a otros formatos.

csb2format

Conversor de ficheros en CSB/AEB norma 43 a otros formatos.

Formatos soportados:

  • OFX XML v1.0.3 & v2.1.1

  • HomeBank CSV

  • HTML

  • JSON

  • ODS: hoja de cálculo OpenDocument

  • CSV, TSV: valores separados por coma o tabulador

  • XLS: hoja de cálculo de Microsoft Excel

  • XLSX: hoja de cálculo OOXML

  • YAML

Opciones:

usage: csb2format [-h] [-s] [-df] [-d DECIMAL]
                [-f {csv,homebank,html,json,ods,ofx,ofx1,tsv,xls,xlsx,yaml}] [-v]
                csbFile convertedFile

Convierte un fichero CSB43 a otro formato

optional arguments:
-h, --help            show this help message and exit
-v, --version         muestra la versión y termina

conversion arguments:
csbFile               fichero csb43 ('-' para entrada estándar)
convertedFile         fichero de destino ('-' para salida estándar)
-s, --strict          modo estricto (por defecto: False)
-df, --dayfirst       usa DDMMYY -día, mes, año- como formato de fecha al
                        interpretar los datos del fichero csb43 en lugar de
                        YYMMDD -año, mes, día- (por defecto: True)
-d DECIMAL, --decimal DECIMAL
                        establece el número de dígitos decimales a considerar
                        en el tipo de divisa (por defecto: 2)
-f {csv,homebank,html,json,ods,ofx,ofx1,tsv,xls,xlsx,yaml}, --format {csv,homebank,html,json,ods,ofx,ofx1,tsv,xls,xlsx,yaml}
                        Formato del fichero de salida (por defecto: ofx)

Ejemplos

  • Convertir a formato OFX:

    $ csb2format transactions.csb transactions.ofx
    
    $ csb2format --format ofx transactions.csb transactions.ofx

    o bien

    $ csb2format transactions.csb - > transactions.ofx

    Desde una aplicación de recuperación de datos a otro fichero

    $ get_my_CSB_transactions | csb2format - transactions.ofx
  • Convertir a hoja de cálculo XLSX (Excel):

    $ csb2format --format xlsx transactions.csb transactions.xlsx

Hojas de cálculo

Los ficheros en ODS, XLS y XLSX se generan a modo de libro, conteniendo la primera hoja la información relativa a las cuentas, y las hojas siguientes conteniendo cada una los movimientos de cada cuenta.

En Python

Lee un archivo CSB43 e imprime el contenido equivalente en OFX

:::python

# OFX
from csb43 import csb_43, ofx

csbFile = csb_43.File(open("movimientos.csb"), strict=False)

# imprime a stdout
print ofx.convertFromCsb(csbFile)

Lee un archivo CSB e imprime el contenido equivalente a CSV de Homebank

:::python

# OFX
from csb43 import csb_43, homebank

csbFile = csb_43.File(open("movimientos.csb"), strict=False)

# imprime a stdout
for line in homebank.convertFromCsb(csbFile):
    print line

Lee un archivo CSB e imprime el equivalente en un archivo de formato tabular o de diccionario

:::python

# OFX
from csb43 import csb_43, formats

csbFile = csb_43.File(open("movimientos.csb"), strict=False)

# imprime formato 'yaml' a stdout
o = format.convertFromCsb(csbFile, 'yaml')
print o.yaml

# escribe a archivo en formato 'xlsx'
o = format.convertFromCsb(csbFile, 'xlsx')
with open("movimientos.xlsx", "wb") as f:
    f.write(o.xlsx)

English

Tools for converting from the Spanish banks’ format CSB norm 43 (CSB43).

csb2format

Convert a CSB/AEB norm 43 file to other file formats.

Supported formats:

  • OFX v1.0.3 (SGML) & v2.1.1 (XML)

  • HomeBank CSV

  • HTML (python2)

  • JSON

  • ODS: OpenDocument spreadsheet (python2)

  • CSV, TSV: comma- or tab- separated values (python2)

  • XLS: Microsoft Excel spreadsheet (python2)

  • XLSX: OOXML spreadsheet (python2)

  • YAML

Options:

usage: csb2format [-h] [-s] [-df] [-d DECIMAL]
              [-f {csv,homebank,html,json,ods,ofx,ofx1,tsv,xls,xlsx,yaml}] [-v]
              csbFile convertedFile

Convert a CSB43 file to another format

positional arguments:
csbFile               a csb43 file ('-' for stdin)
convertedFile         destination file ('-' for stdout)

optional arguments:
-h, --help            show this help message and exit
-s, --strict          strict mode
-df, --dayfirst       use DDMMYY as date format while parsing the csb43 file
                        instead of YYMMDD (default: True)
-d DECIMAL, --decimal DECIMAL
                        set the number of decimal places for the currency type
                        (default: 2)
-f {csv,homebank,html,json,ods,ofx,ofx1,tsv,xls,xlsx,yaml}, --format {csv,homebank,html,json,ods,ofx,ofx1,tsv,xls,xlsx,yaml}
                        Format of the output file (default: ofx)

Examples

  • Converting to OFX format:

    $ csb2format transactions.csb transactions.ofx
    
    $ csb2format --format ofx transactions.csb transactions.ofx

    or

    $ csb2format transactions.csb - > transactions.ofx

    From another app to file

    $ get_my_CSB_transactions | csb2format - transactions.ofx
  • Converting to XLSX spreadsheet format:

    $ csb2format --format xlsx transactions.csb transactions.xlsx

Spreadsheets

ODS, XLS and XLSX files are generated as books, with the first sheet containing the accounts information, and the subsequent sheets containing the transactions of each one of the accounts.

Using Python

Parse a CSB43 file and print the equivalent OFX file

:::python

# OFX
from csb43 import csb_43, ofx

csbFile = csb_43.File(open("movimientos.csb"), strict=False)

# print to stdout
print ofx.convertFromCsb(csbFile)

Parse a CSB43 file and print the equivalent HomeBank CSV file

:::python

# OFX
from csb43 import csb_43, homebank

csbFile = csb_43.File(open("movimientos.csb"), strict=False)

# print to stdout
for line in homebank.convertFromCsb(csbFile):
    print line

Parse a CSB43 file and print the equivalent in a tabular or dictionary-like file format

:::python

# OFX
from csb43 import csb_43, formats

csbFile = csb_43.File(open("movimientos.csb"), strict=False)

# print 'yaml' format to stdout
o = format.convertFromCsb(csbFile, 'yaml')
print o.yaml

# write 'xlsx' format to file
o = format.convertFromCsb(csbFile, 'xlsx')
with open("movimientos.xlsx", "wb") as f:
    f.write(o.xlsx)

Instalación

Usando pip

$ pip install csb43

Installing

Using pip

$ pip install csb43

Changelog

0.6

  • Fixed usage of pycountry >= 16.10.23rc1 objects (thanks to Alex Barcelo).

  • Package refactored to simplify the structure.

0.5

  • Fixed conversion to binary formats in python 2.

  • tablib backend supported in python 3.

  • N43 warnings are silenced by default.

0.4

  • OFX v 1.0.3 supported.

  • OFX Tag inv401source renamed to inv401ksource.

  • Unique transaction id when generating OFX file (thanks to Julien Moutte).

0.3.4

  • Most Spanish N43 files will use LATIN-1 encoding not pure ASCII (thanks to Julien Moutte).

  • Regular expression to check for account name is too limited (thanks to Julien Moutte).

  • Reference1 can hold non numerical data in information mode 1 and 2 (thanks to Julien Moutte).

  • Currency data as an inmutable list.

0.3.3

  • Fixed deficiencies in OFX conversion (thanks to Andrea Santambrogio). Checked XML validation against OFX2_Protocol.xsd

0.3

  • Compatible with Python 3 (except “tablib” dependencies)

0.2.3

  • Fixed shebang header of csb2format

0.2.2

  • csb2format adapted to pyinstaller

  • Executable file for Windows

0.2.1

  • Trivial changes

0.2

  • Several bugfixes

  • Bidirectional use of objects (file -> object, object -> file)

  • Added conversion to spreadsheets, dict and tabular formats (thanks to tablib)

  • Localization to Spanish

  • Sphinx documentation

0.1

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

csb43-0.6.1.tar.gz (625.2 kB view details)

Uploaded Source

Built Distribution

csb43-0.6.1-py2.py3-none-any.whl (72.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file csb43-0.6.1.tar.gz.

File metadata

  • Download URL: csb43-0.6.1.tar.gz
  • Upload date:
  • Size: 625.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for csb43-0.6.1.tar.gz
Algorithm Hash digest
SHA256 f5faa7d25acb6de293d8a90a3290e3733753288ca9a8fe35ff82dc906c77c49f
MD5 0a3640a16f486c99a3902d938d102068
BLAKE2b-256 c276b2c51900052ad7f8c661aa46ccead1ebd4b9af539340a11b8a03aee0319e

See more details on using hashes here.

File details

Details for the file csb43-0.6.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for csb43-0.6.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9501bea48d551b71d5ab9e56fb6049ad015d9bfbc7803c59f30ab6c6001912f8
MD5 9c99c1d227d14964ff1957385ccb2b30
BLAKE2b-256 1f3a4c55e120478474acbc73b54f877f47344225b7e48545a7c9a9961d7ebb63

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page