Read XLSX, XLS and CSV files with a uniform interface Read XLSX, XLS and CSV files with a uniform interface
Project description
* tabular_reader
** Description
A module that maps information from each row in XLSX, XLS, or CSV
files to a ~SimpleNamespace~ object, providing a uniform interface
across different spreadsheet and data formats. Similar to Python's
native [[https://docs.python.org/3/library/csv.html#csv.DictReader][csv.DictReader]] but with support for multiple file types.
** Installing
#+begin_src bash
pip install tabular-reader
#+end_src
** Examples
*** Basic usage with XLSX
#+begin_src python
from tabular_reader import TabularReader
reader = TabularReader("names.xlsx", worksheet="Sheet1")
for row in reader:
print(row.first_name, row.last_name)
#+end_src
Output:
#+begin_src
Boris Johnson
Donald Trump
Mark Rutte
#+end_src
*** Reading CSV files
#+begin_src python
from tabular_reader import TabularReader
reader = TabularReader("data.csv")
for row in reader:
print(row.email, row.phone)
#+end_src
*** Reading XLS files
#+begin_src python
from tabular_reader import TabularReader
reader = TabularReader("legacy_data.xls")
for row in reader:
print(row.id, row.name)
#+end_src
** Custom fieldnames
You can specify fieldnames manually:
#+begin_src python
reader = TabularReader(
"data.xlsx",
fieldnames=["id", "email", "username"]
)
for row in reader:
print(row.id, row.email)
#+end_src
** Skip blank lines
Filter out empty rows:
#+begin_src python
reader = TabularReader(
"data.csv",
skip_blank_lines=True
)
for row in reader:
print(row)
#+end_src
** Keyword arguments
*** For Excel files (XLSX/XLS)
Pass any ~openpyxl.load_workbook~ keyword arguments:
#+begin_src python
reader = TabularReader(
"names.xlsx",
worksheet="Sheet1",
read_only=False,
keep_vba=False,
data_only=False,
keep_links=True
)
#+end_src
*** For CSV files
Pass any ~csv.reader~ keyword arguments:
#+begin_src python
reader = TabularReader(
"data.csv",
delimiter=";",
quotechar='"',
encoding="utf-8"
)
#+end_src
** Features
- Automatic format detection by file extension
- Empty column filtering (only processes columns with headers)
- Uniform interface across XLSX, XLS, and CSV
- ~SimpleNamespace~ objects with attribute access (~row.field_name~)
- Python 3.6 - 3.14 support
** Supported formats
| Format | Extension | Status |
|--------|-----------|-------------|
| Excel | .xlsx | ✓ Supported |
| Excel | .xls | ✓ Supported |
| CSV | .csv | ✓ Supported |
** Acknowledgements
- [[https://openpyxl.readthedocs.io/][openpyxl]]
- [[https://docs.python.org/3/library/csv.html][csv]] - Python's standard library
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tabular_reader-0.1.0.tar.gz.
File metadata
- Download URL: tabular_reader-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df3c24759841be160f60a0500571017b17df337ce05f8d737bbca913a7224219
|
|
| MD5 |
7a70865eccf59e8f046d019f06162f10
|
|
| BLAKE2b-256 |
644829d29d883717d5bcfb7673b4a35e8c18f2485308f0da95cd641340bfda42
|
Provenance
The following attestation bundles were made for tabular_reader-0.1.0.tar.gz:
Publisher:
workflow.yml on arkhan/tabular-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tabular_reader-0.1.0.tar.gz -
Subject digest:
df3c24759841be160f60a0500571017b17df337ce05f8d737bbca913a7224219 - Sigstore transparency entry: 767441949
- Sigstore integration time:
-
Permalink:
arkhan/tabular-reader@b0ef47d6ec773c1507f140f8a27e6c42c8bcff22 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/arkhan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@b0ef47d6ec773c1507f140f8a27e6c42c8bcff22 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tabular_reader-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tabular_reader-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ef863e4fe354576addb32f6a9c0cbbd4c7767996ae1131ff9143e048857d326
|
|
| MD5 |
60b6f6945d0e9372b30ab5425a08a44d
|
|
| BLAKE2b-256 |
d26ea7042cb4720c2bd149d2aad3d1cf07a52623e666b0c5528890d2d04da09e
|
Provenance
The following attestation bundles were made for tabular_reader-0.1.0-py3-none-any.whl:
Publisher:
workflow.yml on arkhan/tabular-reader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tabular_reader-0.1.0-py3-none-any.whl -
Subject digest:
0ef863e4fe354576addb32f6a9c0cbbd4c7767996ae1131ff9143e048857d326 - Sigstore transparency entry: 767441952
- Sigstore integration time:
-
Permalink:
arkhan/tabular-reader@b0ef47d6ec773c1507f140f8a27e6c42c8bcff22 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/arkhan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@b0ef47d6ec773c1507f140f8a27e6c42c8bcff22 -
Trigger Event:
push
-
Statement type: