Skip to main content

excelschema

Excel records' parser and schema viewing and validating tools.

Installation

Method 1:

$ pip install excelschema

Method 2:

  • Clone the project from GitHub
  • poetry install

Usage

To read an Excel file, you may also need to install pyexcel and pyexcel-xlsx as well.

>>> from excelschema import SchemaParser
>>> import pyexcel
>>> sp = SchemaParser(records=pyexcel.get_records(file_name='foo.xlsx', sheet_name='bar'))
>>> sp.schema
{
    'record_id': <class 'int'>,
    'modified': <class 'datetime.datetime'>,
    'data': <class 'str'>
}

Validating records and convert it to a usable one.

>>> sp.ensure_one({'record_id': ' 12', 'data': 567})
{'record_id', 12, 'data': '567'}

Setting constraints

>>> from excelschema import Constraint
>>> sp.update_schema({
...     'user_id': Constraint(type_=int, unique=True, not_null=True)
... })

It is also possible to create an custom schema without an Excel

>>> sp = SchemaParser(schema={
...     'record_id': Constraint(type_=int, unique=True, not_null=True),
...     'modified': datetime
... })

Bonus functions

Cleaning dirty Excel records

>>> from excelschema import parse_record
>>> parse_record({'foo': ' 1', 'bar': ' - ', 'baz': ' '})
{'foo', 1}

Metadata

Release files for excelschema 0.1.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for excelschema 0.1.2.4
File Size Uploaded Provenance Actions
excelschema-0.1.2.4.tar.gz 4.7 kB Without provenance Details for excelschema-0.1.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for excelschema 0.1.2.4
File Interpreter ABI Platform Actions
excelschema-0.1.2.4-py2.py3-none-any.whl Python 2, Python 3 none any Details for excelschema-0.1.2.4-py2.py3-none-any.whl

Total release size: 16.5 kB

Release files / excelschema-0.1.2.4.tar.gz

Download URL excelschema-0.1.2.4.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
252032b935c06dce76064f2928a01a0aaf1c7eb19aade1e5de2ebd297731c2a9
BLAKE2b-256 checksum
How to use checksums
938284a42191599b7110f44ce7968bb0323bd937a9abb672a791951acd6db4f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.11.5 CPython/3.7.0 Darwin/17.7.0

Release files / excelschema-0.1.2.4-py2.py3-none-any.whl

Download URL excelschema-0.1.2.4-py2.py3-none-any.whl
Size 11.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
bac9a183f9fac7666f061229b84e4a48ed8093865c8dee6f0810a54ac7ed7f94
BLAKE2b-256 checksum
How to use checksums
c9477a5dbb47e59c4d8b14b93de2051fad0945bd6fe7191320399eb7b294c3a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.11.5 CPython/3.7.0 Darwin/17.7.0

Security for excelschema 0.1.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page