A professional, rule-based PDF data extraction tool with interactive CLI.
Project description
👽 AlienTables
Turn thousands of PDFs into clean Excel data in minutes.
Enterprise-grade PDF → Excel extraction engine with adaptive OCR, template-aware parsing, and automated validation — built for blazing-fast, production-scale batch processing.
Secure · Runs Locally · Adaptive OCR · Smart Validation · Zero Manual Entry
Table of Contents
- Overview
- Features
- How It Works
- Prerequisites
- Installation
- Usage
- Rules & Best Practices
- Output
- Project Structure
- Configuration
- Troubleshooting
- Dependencies
- Contributing
- License
Overview
AlienTables is a local, privacy-first tool that converts structured PDF documents (invoices, purchase orders, shipping manifests, etc.) into clean, organized Excel spreadsheets — no cloud upload, no manual data entry, no per-page babysitting.
It combines rule-based text parsing with an OCR fallback, so it works reliably on both digitally-generated PDFs and scanned/image-based documents, as long as all files in a batch share the same template layout.
Features
- 🖥️ Interactive CLI — Prompts for input folder, output folder, and column names, no config files required.
- 🧠 Rule-Based Parsing — Extracts key fields (Order No, Date, Customer Details, Product Name, SKUs, Pricing, and more) using regex and positional logic.
- 📊 Excel Output — Automatically writes one
.xlsxfile per PDF, named to match the source file. - 🔍 OCR Fallback — Integrates
pytesseractandpdf2imagefor pages that fail standard text extraction, maximizing data recovery. OCR only kicks in when it's actually needed, keeping runs fast. - 🕵️ Detailed Auditing — Every run generates audit CSVs so you always know what happened:
Audit.csv— extraction status for every page processed.orphan_pages.csv— pages that couldn't be associated with a valid order.review.csv— parsing issues or low-confidence extractions flagged for manual review.
- 🔒 Fully Local — All processing happens on your machine. No data ever leaves your environment.
- ⚡ Batch-Scale — Built to process thousands of PDFs in a single run.
How It Works
- You point AlienTables at a folder of PDFs that share the same layout/template.
- It attempts direct text extraction first, falling back to OCR only on pages where extraction fails.
- Regex and positional rules map the extracted text to the column names you provide.
- Each PDF is written out as its own Excel file, and every page's outcome is logged to the audit CSVs.
Prerequisites
Before installing the Python dependencies, make sure the following system-level tools are installed:
1. Tesseract OCR
Required for OCR fallback on non-text-extractable pages.
- Windows: Install via the UB-Mannheim installer, then either add it to your system
PATHor update theTESSERACT_CMDvariable inAlienTables.py. - macOS:
brew install tesseract - Linux (Debian/Ubuntu):
sudo apt install tesseract-ocr
2. Poppler
Required by pdf2image for rendering PDF pages.
- Windows: Download the latest binaries and update the
POPPLER_PATHvariable inAlienTables.pyto point to thebindirectory. - macOS:
brew install poppler - Linux (Debian/Ubuntu):
sudo apt install poppler-utils
Installation
This project uses pyproject.toml for standard Python packaging. Python 3.8+ is required.
# Clone the repository
git clone https://github.com/alienextractor/alienextractor.git
cd alienextractor
# Create a virtual environment (optional but recommended)
python -m venv .venv
source .venv/bin/activate # On Windows use: .venv\Scripts\activate
# Install the package and dependencies
pip install .
Usage
Run the interactive CLI using the installed script:
alienextractor
Or run the main script directly:
python AlienTables.py
You'll be prompted to:
- Provide the input directory containing your PDF files (defaults to an
inputfolder). - Provide the output directory for the generated Excel files.
- Enter the exact column names that exist in your PDF template.
Rules & Best Practices
Following these rules ensures accurate, predictable extraction:
- Enter exact column names — they must match what actually exists in your PDF template.
- Wrong column names = bad data — incorrect names can produce blank or random values in the output.
- One template per run — all PDFs in a batch should follow the same layout/template.
- Multiple templates? — process each template separately, in its own run.
- Group consistently — keep PDFs with the same columns together for a single run.
- OCR is automatic — it only triggers when standard text extraction fails, keeping processing fast.
- Default input location — create an
inputfolder and place all PDFs there unless you specify a custom path.
Output
After processing, AlienTables generates:
| File | Description |
|---|---|
<filename>.xlsx |
One Excel file per source PDF, containing extracted structured data |
Audit.csv |
Extraction status for every page processed |
orphan_pages.csv |
Pages that couldn't be matched to a valid order |
review.csv |
Low-confidence or problematic extractions flagged for manual review |
Project Structure
alienextractor/
├── AlienTables.py # Main extraction script / CLI entry point
├── pyproject.toml # Package metadata and dependencies
├── input/ # Default folder for source PDFs
└── output/ # Default folder for generated Excel files
Configuration
TESSERACT_CMD— path to your Tesseract executable (edit inAlienTables.pyif not inPATH).POPPLER_PATH— path to your Popplerbindirectory (edit inAlienTables.pyif not inPATH).- Column names — provided interactively at runtime; must exactly match your PDF template's fields.
Troubleshooting
| Issue | Likely Cause | Fix |
|---|---|---|
| Blank or random values in output | Column names don't match the PDF template | Double-check exact spelling/casing of column names |
| Slow processing | OCR fallback triggering frequently | Verify PDFs are text-based, not scanned images, where possible |
TesseractNotFoundError |
Tesseract not installed or not in PATH |
Install Tesseract and/or set TESSERACT_CMD |
PDFInfoNotInstalledError |
Poppler not installed or not in PATH |
Install Poppler and/or set POPPLER_PATH |
Pages showing up in orphan_pages.csv |
Page couldn't be linked to a valid order | Review the page manually; template may differ from the rest of the batch |
Dependencies
PyMuPDF— PDF text extractionpandas— data handlingopenpyxl— Excel file generationpython-dateutil— date parsingtqdm— progress barspdf2image— PDF-to-image conversion for OCRPillow— image processingpytesseract— OCR engine wrapper
Contributing
Issues and pull requests are welcome. Please open an issue first to discuss significant changes.
License
This project is licensed under the MIT License.
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 alientables-2.1.tar.gz.
File metadata
- Download URL: alientables-2.1.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
626fa2ba94868c25ccc4a930e834ad564ecdffac17bcf200780d7a273189bc78
|
|
| MD5 |
98dd29cc20468b8d6d99020573849bbd
|
|
| BLAKE2b-256 |
74d04a07629676d29529bf51cc116b6851e2a275506d251b1d34df20490c2de0
|
File details
Details for the file alientables-2.1-py3-none-any.whl.
File metadata
- Download URL: alientables-2.1-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef1edbfa55c0dca1e6ca3b0336fa78c02931054870097e19338b3a5adc2a77cf
|
|
| MD5 |
f120bb0449bf70d3855988d98265a3d0
|
|
| BLAKE2b-256 |
6d95196d6955e78c0f79291b7a7783f8f47ed94043ae06c9241716d5aff70929
|