Skip to content

UpswingOps/jpk-fa-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jpk-fa-parser

JPK FA parser - a simple Python script to parse JPK_FA XML file and convert loaded data to CSV, JSON or DB.

What is JPK (in Polish) https://poradnikprzedsiebiorcy.pl/-jpk-fa-struktura-wszystko-co-warto-wiedziec

JPK structure (in Polish) https://www.gov.pl/web/kas/struktury-jpk

Installation

.venv\Scripts\python -m pip install -r requirements.txt

Setup

Add .env file in the root directory

DB_HOST=localhost
DB_NAME=jpk_fa_db
DB_USER=db_user
DB_PASSWORD=db_password
#DB_PORT=5432

There is an example input.xml file with some basic (partial!) data.

Use your real exported JPK file XML file. You can do that using Subiekt123 (https://subiekt123.pl/) or other accounting software.

In Subiekt 123 go to Księgowość -> + icon on top right -> select Faktury VAT (JPK_FA) and dates range -> Select version JPK_VAT (v3) -> Zapisz -> Export XML file

Pretty format XML file

python -c "import sys, xml.dom.minidom as md; print(md.parse(sys.stdin).toprettyxml())" < input.xml > output.xml

Testing

.venv\Scripts\python -m unittest

Linting

.venv\Scripts\python -m pylint **/*.py

Usage

Export to CSV

.venv\Scripts\python main.py input.xml csv

or

start.bat csv

Export to JSON

.venv\Scripts\python main.py input.xml json

or

start.bat json

Export to HTML

.venv\Scripts\python main.py input.xml html

or

start.bat html

Export to DB

.venv\Scripts\python main.py input.xml db

or

start.bat db

Clear output directories

start.bat clear

License

MIT

About

JPK FA parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published