Tabulex
English | Espanol
English
Tabulex is a Python library for detecting tables in digital PDFs, reconstructing their structure, and exporting them to pandas, polars, and JSON.
Features
- Process one-page or multi-page PDF files.
- Detect tables with
PyMuPDFplus a text-geometry fallback heuristic. - Preserve multiline cells by joining lines with
\n. - Represent merged cells with
rowspanandcolspanin an intermediate model. - Store cell images as base64.
- Export tables as Pandas, Polars, or JSON.
Installation
pip install tabulex
Quick Start
from tabulex import extract_tables
result = extract_tables("sample-tables.pdf", return_type="all")
print(result.pandas_tables[0])
print(result.polars_tables[0])
print(result.json_tables[0])
JSON Output
from tabulex import extract_tables
result = extract_tables("sample-tables.pdf", return_type="json")
print(result.json_tables[0])
Main API
extract_tables(
pdf_path: str,
pages: list[int] | None = None,
return_type: str = "both",
preserve_spans: bool = True,
preserve_images: bool = True,
image_encoding: str = "base64",
engine: str = "pymupdf",
)
extract_tables(...) returns an ExtractionResult with:
tablespandas_tablespolars_tablesjson_tablesmetadata
Limitations
- V1 targets digital PDFs.
- Scanned PDFs and OCR-heavy workflows are not part of the default path.
- Borderless tables still rely on heuristics.
- Tables continued across pages are handled separately.
License
MIT. See LICENSE.
Espanol
Tabulex es una libreria Python para detectar tablas en PDFs digitales, reconstruir su estructura y exportarlas a pandas, polars y JSON.
Caracteristicas
- Procesa PDFs de una o varias paginas.
- Detecta tablas con
PyMuPDFy una heuristica de respaldo basada en geometria del texto. - Conserva celdas multilinea uniendo las lineas con
\n. - Representa celdas fusionadas con
rowspanycolspanen un modelo intermedio. - Almacena imagenes de celdas como base64.
- Exporta tablas a Pandas, Polars o JSON.
Instalacion
pip install tabulex
Uso Rapido
from tabulex import extract_tables
result = extract_tables("sample-tables.pdf", return_type="all")
print(result.pandas_tables[0])
print(result.polars_tables[0])
print(result.json_tables[0])
Salida JSON
from tabulex import extract_tables
result = extract_tables("sample-tables.pdf", return_type="json")
print(result.json_tables[0])
API Principal
extract_tables(
pdf_path: str,
pages: list[int] | None = None,
return_type: str = "both",
preserve_spans: bool = True,
preserve_images: bool = True,
image_encoding: str = "base64",
engine: str = "pymupdf",
)
extract_tables(...) devuelve un ExtractionResult con:
tablespandas_tablespolars_tablesjson_tablesmetadata
Limitaciones
- La V1 esta pensada para PDFs digitales.
- Los PDFs escaneados y los flujos con OCR no forman parte del camino principal.
- Las tablas sin bordes siguen dependiendo de heuristicas.
- Las tablas continuadas entre paginas se procesan por separado.
Licencia
MIT. Consulta LICENSE.
Metadata
Release files for tabulex 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tabulex-0.1.0.tar.gz | 20.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tabulex-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.3 kB
Release files / tabulex-0.1.0.tar.gz
| Download URL | tabulex-0.1.0.tar.gz |
|---|---|
| Size | 20.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2a3ca4d614059711f5a1c83ee522cf9336b68c07f8f7e03dac4aa302a3119f0
|
|
BLAKE2b-256 checksum How to use checksums |
f87c7f1855636b6c14a30bfc67d2887ab7ce7097161d2266937d89925083a65b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / tabulex-0.1.0-py3-none-any.whl
| Download URL | tabulex-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bea3925b31638822340043384b19d77f1da5e49c1a70eb74c7b22350281cf41b
|
|
BLAKE2b-256 checksum How to use checksums |
6b909e24aeedb3931913dbb34ddb12a50f2bfaf798d331e515e0ce5beab0b060
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|