Extract data from Excel documents.
Project description
exex
Extract data from Excel documents
Installation
pip install exex
Usage
Load Excel file
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 cells
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"]
Rangge of columns
parse.values(sheet["A:B"])
[
["name", "alpha", "beta", "gamma"],
["abbreviation", "a", "b", "g"],
]
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.8.tar.gz
(3.3 kB
view details)
Built Distribution
exex-0.1.8-py3-none-any.whl
(3.0 kB
view details)
File details
Details for the file exex-0.1.8.tar.gz
.
File metadata
- Download URL: exex-0.1.8.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.0 Linux/4.15.0-99-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | addd137443cc98e985f4795393b9a236ac538e2882eacd1cfbc661b7b7acadf5 |
|
MD5 | 3d2be3d2c2ea6c05ba2ce6ba29bad72f |
|
BLAKE2b-256 | 5d89245b33933b3417a3454dd5c814623608a84e3538929628f0ab9bfc4a6da6 |
File details
Details for the file exex-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: exex-0.1.8-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.0 Linux/4.15.0-99-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ef00c9d0bd28d7418a497fdc68a6392c4c5d4c44838043abbe3501c03653dc6 |
|
MD5 | 3c48f53dd35d07ac12ef5a11c2a778c9 |
|
BLAKE2b-256 | 53e69221774df100a1a20b9268df1de189d98c6fc1c9fab615a7820552ee5810 |