Bank Statement Parser: Installation Prerequisites
Welcome to the Bank Statement Parser User Guide. Get started with our Python library for easy CAMT and SEPA file parsing and streamline your financial analysis.
System Requirements
Before beginning, ensure your system meets the following criteria:
- Python 3.6 or newer installed.
- Command-line interface (CLI) access, such as Terminal or Command Prompt.
Installation
Create a Virtual Environment
We recommend creating a virtual environment to install the Bank Statement Parser. This will ensure that the package is installed in an isolated environment and will not affect other projects.
python3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
Installing the Bank Statement Parser
Install bankstatementparser
with just one command:
pip install bankstatementparser
Installing Dependencies
Open your CLI and navigate to the library’s directory, then execute the following:
pip install -r requirements.txt
Get the Source Code on GitHub
You can access the source code for the Bank Statement Parser by downloading releases, browsing or even contributing to its development on GitHub ⧉. You can also report issues and request new features, which we will review and address as soon as possible.
Usage
CAMT Files
from bankstatementparser import CamtParser
# Initialize the parser with the CAMT file path
camt_parser = CamtParser('path/to/camt/file.xml')
# Parse the file and get the results
results = camt_parser.parse()
PAIN.001 Files
from bankstatementparser import Pain001Parser
# Initialize the parser with the PAIN.001 file path
pain_parser = Pain001Parser('path/to/pain/file.xml')
# Parse the file and get the results
results = pain_parser.parse()
Command Line Interface (CLI) Guide
Leverage the CLI for quick parsing tasks with the following commands:
Basic Command
python cli.py --type <file_type> --input <input_file> [--output <output_file>]
--type
: Type of the bank statement file. Currently supported types are “camt” and “pain001”.--input
: Path to the bank statement file.--output
: (Optional) Path to save the parsed data. If not provided, data is printed to the console.
Examples for CAMT Files
-
Parse a CAMT file and print the results to the console:
python cli.py --type camt --input path/to/camt/camt_file.xml
Using the test data:
python ./bankstatementparser/cli.py --type camt --input ./tests/test_data/camt.053.001.02.xml
-
Parse a CAMT file and save the results to a CSV file:
python cli.py --type camt --input path/to/camt/file.xml --output path/to/output/file.csv
Using the test data:
python ./bankstatementparser/cli.py --type camt --input ./tests/test_data/camt.053.001.02.xml --output ./tests/test_data/camt_file.csv
Examples for PAIN.001 Files
- Parse a PAIN.001.001.03 file and print the results to the console:
python cli.py --type pain001 --input path/to/pain.001.001.03.xml
Using the test data:
python ./bankstatementparser/cli.py --type pain001 --input ./tests/test_data/pain.001.001.03.xml
- Parse a PAIN.001.001.03 file and save the results to a CSV file:
python cli.py --type pain001 --input path/to/pain.001.001.03.xml --output path/to/output/file.csv
Using the test data:
python ./bankstatementparser/cli.py --type pain001 --input ./tests/test_data/pain.001.001.03.xml --output ./tests/test_data/pain_file.csv