--- 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