Extract data from Excel documents.
Project description
exex
Extract data from Excel documents
Installation
pip install exex
Usage
from openpyxl import load_workbook
from exex import parse
book = load_workbook("sample.xlsx") # load excel file
sheet = book.active # get active sheet
# single cell by name
parse.values(sheet["A1"])
"name"
# single cell by row/column number
parse.values(sheet.cell(row=1, column=1))
"name"
# range of cells
parse.values(sheet["A1":"B2"])
[
["name", "abbreviation"],
["alpha", "a"],
]
# all values
parse.values(sheet.values)
[
["name", "abbreviation", "age"],
["alpha", "a", 1],
["beta", "b", 2],
["gamma", "g", 3],
]
# row by number
parse.values(sheet[1])
["alpha", "a", 1]
# range of rows
parse.values(sheet[1:2])
[
["name", "abbreviation", "age"],
["alpha", "a", 1],
]
# column by name
parse.values(sheet["A"])
["name", "alpha", "beta", "gamma"]
# column range
parse.values(sheet["A:B"])
[
["name", "alpha"],
["abbreviation", "a"],
]
Ways to access sheets
# Sheets
book.sheets[0] # (sheet) sheet by index
book.sheets["prices"] # (sheet) sheet by name
book.active # (sheet) active sheet
book.sheetnames # (array) sheet names
Development
Tests (local Python version)
poetry run pytest
Tests (all Python versions defined in tox.ini
)
poetry run tox
Code formatting (black)
poetry run black .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
exex-0.1.7.tar.gz
(3.3 kB
view details)
Built Distribution
exex-0.1.7-py3-none-any.whl
(3.1 kB
view details)
File details
Details for the file exex-0.1.7.tar.gz
.
File metadata
- Download URL: exex-0.1.7.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.8.0 Linux/4.15.0-66-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2a7f65c63365745da229b5578a9b01700f048df55892b50bc500cd79bcd2713 |
|
MD5 | db636c51b30a73e27aa9c8b08caa44fa |
|
BLAKE2b-256 | 35d99909ac2bec591f5fcd9de3ae5a5eaec6cc6a1b24774172dad75d4e8ab097 |
File details
Details for the file exex-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: exex-0.1.7-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.8.0 Linux/4.15.0-66-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c71588be10fba2a272fda3ddb0fefaf61982b06d6b0c434e8cba772add823ffb |
|
MD5 | dab49040fe0d3300b30d365501ed01f4 |
|
BLAKE2b-256 | 655dd6daa771e19e1c1602439cf7bbbffda1cf787fbeab252f25066d54f88e61 |