Patterns for reading writing spreadsheet documents
Project description
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 cells against it
Date
Enums (e.g. only the values yes and no are allowed)
Floating point numbers (+minimum/maximum check)
Integer numbers (+minimum/maximum check)
String (+RegEx pattern check)
Get a dictionary as output with the following form row number -> header name -> cell value
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 } } ] }
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
Hashes for groundwork_spreadsheets-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3ddfb4ff07c5e49026ed6ca8e1a68869bcd64b2fa1d8aa05433ec431c5e5d81 |
|
MD5 | 9835c9b8b52320e6bf25a903a221fdb5 |
|
BLAKE2b-256 | 28145d9e588d17ee117cb497d1678384ab6ed684f41fe380abfdf27943655b76 |