Skip to main content

Validation of template based Excel files

Project description

Excel Validator

Excel Validator is a Python package designed to validate Excel files (.xlsx) based on configured schemas. The tool ensures your Excel files adhere to specified schemas and generates detailed reports in case of validation errors. Built on the robust Frictionless library, Excel Validator also allows for dynamic schema creation, where fields are included based on row data from other sheets.

Features

  • Validate Excel files against predefined schemas.
  • Generate detailed reports highlighting any validation issues.
  • Dynamic schema creation based on data from other sheets.
  • Easy integration with your existing data processing workflows.
  • Built on top of the Frictionless library for reliable and extensible validation.
  • Integrated webservice for online validation.

Installation

The software requires at least Python version 3.11. It is recommended to create and activate a dedicated conda environment for the installation of this software:

conda create -n excel-validator python=3.11
conda activate excel-validator

Now you can install Excel Validator via pip:

pip install excel-validator

Usage

Once installed, the software can be directly used from the command line interface. Use the --help option to get additional instructions on how to use it:

usage: excel-validator [-h] {validate,configuration,webservice} ...

Three different commands can be used, each with its own options:

  • validate: validates the provided Excel file
  • configuration: creates an initial configuration based on the provided Excel file
  • webservice: starts a web service for online validation of Excel files

Examples

Validation of Excel file:

# validate filename.xlsx using miappe template
excel-validator validate --config miappe filename.xlsx

# validate filename.xlsx using miappe template and show report
excel-validator validate --config miappe --report filename.xlsx

# validate filename.xlsx using miappe template and store report as filename.txt
excel-validator validate --config miappe filename.xlsx --createTextReport

# validate filename.xlsx using custom template in location/configuration/custom
excel-validator validate --config location/configuration/custom filename.xlsx

Create initial validation configuration for Excel file:

# create configuration filename.xlsx and store in location/configuration/initial
excel-validator configuration filename.xlsx --output location/configuration/initial

Start webservice for validation Excel files:

# start webservice and create new configuration file config.ini if it doesn't exist
excel-validator webservice

# start webservice and using a specific configuration file
excel-validator webservice --config configuration/webservice/config.ini

Python

The package can also imported directly in your Python application:

import excel_validator

#optionally enable logging
import logging
logging.basicConfig(format="%(asctime)s | %(levelname)s: %(message)s", datefmt="%m-%d-%y %H:%M:%S")
logging.getLogger("excel_validator.validator").setLevel(logging.INFO)

excelFilename = "/path/to/filename.xlsx"
configFilename = "/path/to/specific/configuration"
validation = excel_validator.Validate(excelFilename,configFilename)

A configuration for MIAPPE is already included in the software and can be used with:

configFilename = excel_validator.Validate.getConfigFilename("miappe")

The validation object contains the status (validation.valid) and can be used to create a report if the Excel file is found to be invalid:

validation.createMarkdownReport("report.md")
print(validation.createTextReport())

This software has been developed for the AGENT project

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

excel_validator-0.9.1.tar.gz (132.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

excel_validator-0.9.1-py3-none-any.whl (147.6 kB view details)

Uploaded Python 3

File details

Details for the file excel_validator-0.9.1.tar.gz.

File metadata

  • Download URL: excel_validator-0.9.1.tar.gz
  • Upload date:
  • Size: 132.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.5

File hashes

Hashes for excel_validator-0.9.1.tar.gz
Algorithm Hash digest
SHA256 10f6277f603164a604b2c02f5204a6de7fe7fc60fd04035f78655e1513a9f7bd
MD5 c4399bb713aaf57f6ed9b48aa67aa5f3
BLAKE2b-256 1e9ce7b12867fee4de2739f9219e2e26f0ef875226db094f87f2e8341d2d21bb

See more details on using hashes here.

File details

Details for the file excel_validator-0.9.1-py3-none-any.whl.

File metadata

File hashes

Hashes for excel_validator-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f0e9ea3e60d1ea0702e3532d307a77bf85a45b357426b7d52144b4046b1adf5e
MD5 601d4d5d500f9e317ed3273b1e4b172b
BLAKE2b-256 3a266ff6a30c383d6de6f31d7b0ffab19de847e773cbf97f3e1bdb4f0bfdf9c2

See more details on using hashes here.

Supported by

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