Skip to main content

groundwork-spreadsheets

Groundwork patterns to read and write spreadsheet documents. Excel 2010 (xlsx, xlsm) is supported at the moment. The full documentation is available at https://groundwork-spreadsheets.readthedocs.io/

For more information regarding groundwork, see here.

ExcelValidationPattern

  • Uses the library openpyxl

  • Can read Excel 2010 files (xlsx, xlsm)

  • Configure your sheet using a json file

  • Auto detect columns by names

  • Layout can be

    • column based: headers are in a single row and data is below

    • row based: headers are in a single column and data is right of the headers

  • Define column types and verify cell values against them

    • Date

    • Enums (e.g. only the values ‘yes’ and ‘no’ are allowed)

    • Floating point numbers with optional min/max check

    • Integer numbers with optional min/max check

    • String with optional regular expression pattern check

  • Exclude data row/columns based on filter criteria

  • Output is a dictionary of the following form row or column number -> header name -> cell value

  • Extensive logging of problems

Here is how an example json config file looks like:

{
    "sheet_config": "last",
    "orientation": "column_based",
    "headers_index_config": {
        "row_index": {
            "first": 1,
            "last": "automatic"
        },
        "column_index": {
            "first": "automatic",
            "last": "severalEmptyCells:3"
        }
    },
    "data_index_config": {
        "row_index": {
            "first": 2,
            "last": "automatic"
        },
        "column_index": {
            "first": "automatic",
            "last": "automatic"
        }
    },
    "data_type_config": [
        {
            "header": "hex number",
            "fail_on_type_error": true,
            "fail_on_empty_cell": false,
            "fail_on_header_not_found": true,
            "type": {
                "base": "string",
                "pattern": "^0x[A-F0-9]{6}$"
            }
        },
        {
            "header": "int number",
            "type": {
                "base": "integer",
                "minimum": 2
            }
        }
    ]
}

Metadata

Release files for groundwork-spreadsheets 0.4.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 groundwork-spreadsheets 0.4.4
File Size Uploaded
groundwork_spreadsheets-0.4.4.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for groundwork-spreadsheets 0.4.4
File Interpreter ABI Platform
groundwork_spreadsheets-0.4.4-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / groundwork_spreadsheets-0.4.4.tar.gz

Download URL groundwork_spreadsheets-0.4.4.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c81b72856f115b1a213a504ba21f69083027430d221211f019ec4978c15ace67
BLAKE2b-256 checksum
How to use checksums
e8ae843ec81683df122c7a2f40bd0876aad08c9fd89b5e27213d2e32d8d26ffd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.6.7 Linux/4.15.0-1028-gcp

Release files / groundwork_spreadsheets-0.4.4-py3-none-any.whl

Download URL groundwork_spreadsheets-0.4.4-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d1106ee48e8be4edded9003debb9ab40d5ef583919abee698cf945ac0d05e6e
BLAKE2b-256 checksum
How to use checksums
9bb277c3bf86cde626a92f7ddb0e13b003495cb235fb0cedce2068dd723d0966
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.6.7 Linux/4.15.0-1028-gcp

Release history Release notifications | RSS feed

This release

0.4.4 This release

2 release files

0.4.3

2 release files

0.3.0

1 release file

0.2.0

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

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