Spaces:
Sleeping
Sleeping
|
Download README.md from ozsparkhub/pdf-table-extract-api: direct link, hf CLI and curl.
- Browser
- Download file 2.94 kB
-
https://huggingface.co/spaces/ozsparkhub/pdf-table-extract-api/resolve/main/README.md
- Command line
-
hf download hf://spaces/ozsparkhub/pdf-table-extract-api/README.md
-
curl -L -o README.md https://huggingface.co/spaces/ozsparkhub/pdf-table-extract-api/resolve/main/README.md
2.94 kB
| title: PDF to Excel Converter API | |
| emoji: π | |
| colorFrom: green | |
| colorTo: blue | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: false | |
| license: mit | |
| # PDF to Excel Converter API | |
| Extract tables from text-based PDF files to Excel (XLSX) or CSV format. | |
| ## Features | |
| β **Direct Table Extraction** - Uses pdfplumber first for text-based PDFs | |
| β **Dual Format Support** - Export as Excel (.xlsx) or CSV (.csv) | |
| β **Multiple Tables** - Creates separate sheets for each table (XLSX) | |
| β **Markdown Fallback** - Falls back to Markdown table parsing when direct extraction is not enough | |
| β **Free & Unlimited** - No API limits or costs | |
| β **100% Privacy** - Files processed temporarily, not stored | |
| ## How It Works | |
| 1. **PDF β Tables** - pdfplumber extracts rows and columns from text-based PDFs | |
| 2. **Fallback β Markdown Tables** - A document parser is used when direct extraction finds no tables | |
| 3. **Tables β Excel/CSV** - pandas creates spreadsheet files | |
| ## API Usage | |
| ### JavaScript/TypeScript | |
| ```javascript | |
| const API_URL = "https://ozsparkhub-pdf-to-excel-api.hf.space"; | |
| async function convertPdfToExcel(pdfFile, format = "xlsx") { | |
| const formData = new FormData(); | |
| formData.append('file', pdfFile); | |
| formData.append('output_format', format); | |
| const response = await fetch(`${API_URL}/call/convert`, { | |
| method: 'POST', | |
| body: formData | |
| }); | |
| const result = await response.json(); | |
| return result.file_data; // base64 Excel/CSV data | |
| } | |
| ``` | |
| ### Python | |
| ```python | |
| import requests | |
| with open("path/to/file.pdf", "rb") as pdf: | |
| response = requests.post( | |
| "https://ozsparkhub-pdf-to-excel-api.hf.space/call/convert", | |
| files={"file": pdf}, | |
| data={"output_format": "xlsx"}, | |
| ) | |
| print(response.json()) | |
| ``` | |
| ## Technical Stack | |
| - **pdfplumber** - Direct table extraction for text-based PDFs | |
| - **Document parser fallback** - Markdown table fallback | |
| - **pandas** - Data manipulation and Excel generation | |
| - **openpyxl** - Excel file creation engine | |
| - **FastAPI** - API interface | |
| ## Use Cases | |
| π **Data Extraction** - Extract financial tables from PDF reports | |
| πΌ **Business Analytics** - Convert invoices and statements to Excel | |
| π **Research Data** - Extract scientific tables for analysis | |
| π’ **Document Processing** - Automate PDF table extraction workflows | |
| π **Report Generation** - Convert PDF reports to editable spreadsheets | |
| ## Limitations | |
| - Maximum file size: 10MB | |
| - Works best with text-based PDFs, not scanned/image-only documents | |
| - Complex merged cells may need manual adjustment | |
| - Borderless or heavily designed tables may need manual cleanup | |
| ## Credits | |
| Created by [OzSparkHub Business Tools](https://biz.ozsparkhub.com.au) | |
| Powered by: | |
| - [pdfplumber](https://github.com/jsvine/pdfplumber) | |
| - [pandas](https://pandas.pydata.org/) | |
| - [openpyxl](https://openpyxl.readthedocs.io/) | |
| - [FastAPI](https://fastapi.tiangolo.com/) | |
| ## License | |
| MIT License - Free for commercial and personal use | |