pytablereader
raw JSON → 0.31.4 verified Fri May 01 auth: no python
pytablereader is a Python library to load structured table data from files, strings, or URLs supporting multiple formats: CSV, Excel, Google Sheets, HTML, JSON, LDJSON, LTSV, Markdown, SQLite, TSV. Currently at v0.31.4, with a monthly/bimonthly release cadence and active maintenance.
pip install pytablereader Common errors
error ModuleNotFoundError: No module named 'pytablereader' ↓
cause Library not installed or installed without required extras.
fix
Run
pip install pytablereader[all] or install specific extras as needed. error ImportError: cannot import name 'load_tables' from 'pytablereader' ↓
cause Possibly using an older version where the function was not exposed.
fix
Update pytablereader to >=0.29.0 with
pip install --upgrade pytablereader. error ValueError: The specified format is not supported: ... ↓
cause Unsupported file format string passed.
fix
Use one of: csv, tsv, json, ltsv, markdown, excel, html, sqlite, gs. Check formatting parameter.
Warnings
breaking Dropped Python 2 support in v0.28.0. Code using Python 2 idioms will break. ↓
fix Use Python 3.7+ and update any Python 2 specific code.
deprecated The old type detection for CSV was disabled by default in v0.31.0. Use type_hints argument explicitly if you need automatic type detection. ↓
fix Pass type_hints=True to load_tables or loader classes to enable type detection.
gotcha When using Google Sheets, the library requires authentication via gspread. If oauth2 credentials are not set, loading will fail with auth errors. ↓
fix Set up gspread authentication (service account or OAuth) before calling load_tables with a Google Sheets URL.
gotcha File paths with special characters may cause path validation errors on some platforms. The library uses pathvalidate for validation. ↓
fix Ensure file paths are valid for the platform; use raw strings or os.path functions.
Install
pip install pytablereader[excel] pip install pytablereader[html] pip install pytablereader[gs] Imports
- load_tables wrong
import pytablereadercorrectfrom pytablereader import load_tables - TableFileLoader wrong
from pytablereader.loader import TableFileLoadercorrectfrom pytablereader import TableFileLoader - TableUrlLoaderFactory
from pytablereader import TableUrlLoaderFactory
Quickstart
from pytablereader import load_tables
# Load CSV from URL
tables = load_tables('https://raw.githubusercontent.com/thombashi/pytablereader/master/example.csv')
for table in tables:
print(table)
# Load from file
with open('data.csv') as f:
tables = load_tables(f)
for table in tables:
print(table)