kraenzle-ritter / spreadsheet-inspect
CLI tool to inspect and analyze Excel/ODS spreadsheet files
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
pkg:composer/kraenzle-ritter/spreadsheet-inspect
Requires
- php: ^8.3
- dompdf/dompdf: ^3.1
- laravel-zero/framework: ^12.0.2
- phpoffice/phpspreadsheet: ^5.4
- rap2hpoutre/fast-excel: ^5.6
Requires (Dev)
- laravel/pint: ^1.25.1
- mockery/mockery: ^1.6.12
- pestphp/pest: ^3.8.4|^4.1.2
README
A CLI tool to inspect Excel (.xlsx, .xls) and LibreOffice (.ods) spreadsheet files. Analyze sheet structures, column statistics, find cross-sheet references, and extract embedded images.
Features
- π Sheet Analysis β List all sheets, view column headers, row counts, and fill rates
- π Value Statistics β See distinct values per column with occurrence counts
- π Cross-Sheet Reference Check β Find where values from one sheet appear in others
- πΌοΈ Image Inspection β Count and extract embedded images/drawings
- π Multiple Formats β Supports Excel (.xlsx, .xls) and LibreOffice Calc (.ods)
Installation
Download PHAR (recommended)
Download the latest release:
curl -L https://github.com/kraenzle-ritter/spreadsheet-inspect/releases/latest/download/spreadsheet-inspect -o spreadsheet-inspect chmod +x spreadsheet-inspect
Optionally move to your PATH:
sudo mv spreadsheet-inspect /usr/local/bin/
From Source
git clone https://github.com/kraenzle-ritter/spreadsheet-inspect.git
cd spreadsheet-inspect
composer install
Usage
Note: Replace
php inspectwithspreadsheet-inspectif using the PHAR.
List all sheets
php inspect spreadsheet myfile.xlsx --sheets
Analyze a specific sheet
php inspect spreadsheet myfile.xlsx --sheet=1 # or by name php inspect spreadsheet myfile.xlsx --sheet="Sheet Name"
Output:
## Available sheets
- **[1]** `Products`
- **[2]** `Categories`
# Sheet `Products` (Index: 1)
## Sheet statistics
- **Rows** (excluding header): `150`
### `ProductID`
- **Filled**: `150 / 150` (100%)
- **Distinct**: `150`
### `Category`
- **Filled**: `148 / 150` (98.67%)
- **Distinct**: `12`
Values:
- `Electronics` (45)
- `Clothing` (32)
...
Analyze images in a sheet
php inspect spreadsheet myfile.xlsx --sheet=1 --images
Extract images to a directory
php inspect spreadsheet myfile.xlsx --sheet=1 --extract-images=./images
Cross-sheet reference check
Find where values from a column appear in other sheets:
php inspect spreadsheet myfile.xlsx --sheet=1 --column=ProductID
Check against a specific target sheet:
php inspect spreadsheet myfile.xlsx --sheet=1 --column=ProductID --cross-sheet=2
Compare only against a specific column in target sheets:
php inspect spreadsheet myfile.xlsx --sheet=1 --column=ProductID --target-column=ID
Options
| Option | Description |
|---|---|
--sheets |
List all sheet names only |
--sheet= |
Inspect a specific sheet (by index or name) |
--column= |
Cross-search for values from this column |
--cross-sheet= |
Only check this target sheet |
--target-column= |
Only compare against this column in target sheets |
--images |
Count and list images in the sheet |
--extract-images= |
Extract images to specified directory |
--output= |
Output format: console (default), html, pdf |
--output-file= |
Output file path (required for html/pdf) |
--debug |
Show detailed matching values |
--memory= |
Memory limit in MB (default: 2000) |
Export to HTML or PDF
Generate a styled HTML report:
php inspect spreadsheet myfile.xlsx --sheet=1 --output=html --output-file=report.html
Generate a PDF report:
php inspect spreadsheet myfile.xlsx --sheet=1 --output=pdf --output-file=report.pdf
Supported Formats
- Microsoft Excel:
.xlsx,.xls - LibreOffice Calc:
.ods
Requirements
- PHP 8.3+
- Composer
Testing
./vendor/bin/pest
Built With
- Laravel Zero β Micro-framework for console applications
- PhpSpreadsheet β Library for reading/writing spreadsheet files
- FastExcel β Fast Excel import/export
- Dompdf β HTML to PDF converter
License
MIT License. See LICENSE for details.