Arabic PDF Table to Excel Without Scrambled Columns (RTL & Eastern Numerals Guide)
Convert scanned and multi-page Arabic–English PDF tables into clean Excel (.xlsx) and UTF-8 CSV files with normalized numbers and automatic header stitching.
Why Arabic & Bilingual PDF Tables Break in Tabula, Camelot, and Excel
Converting Arabic or bilingual Arabic–English tabular PDFs—such as Saudi ZATCA tax invoices, UAE bank statements, bills of quantities (BOQs), and supplier price lists—into clean Excel spreadsheets fails in four predictable ways. First, rule-based extractors like Tabula, Camelot, and pdfplumber rely on embedded LTR text coordinates, causing right-to-left Arabic columns (الإجمالي | الضريبة | الكمية | الوصف) to shift or merge with English sub-headers. Second, scanned or photographed PDFs contain no text layer at all, returning empty DataFrames. Third, cells printed with Eastern Arabic-Indic numerals (٠١٢٣٤٥٦٧٨٩) and Arabic decimal/thousands separators import into Excel as plain text strings, silently breaking SUM() formulas and ERP ingestion. Fourth, writing plain UTF-8 CSV without a Byte Order Mark (BOM) causes Microsoft Excel on Windows and macOS to render Arabic text as unreadable mojibake.
Stitched Bilingual Table OCR to Native Excel (.xlsx) & UTF-8 BOM CSV
StructOCR's Arabic OCR API solves both layout extraction and numeral cleanup in one call to POST /v1/pdf-extract. Upload digital or 150+ DPI scanned PDFs (up to 10 MB, up to 20 pages per call) with mode=tables and stitch_tables=true. StructOCR preserves bilingual column alignment, strips duplicate continuation headers across pages, and normalizes Eastern Arabic-Indic digits to standard Western numbers ready for Excel formulas. Try the preloaded bilingual Arabic invoice specimen below, open our free PDF table extractor (with one-click Excel .xlsx and UTF-8 CSV export), or explore our general scanned PDF to Excel guide.
High-Volume Arabic PDF Table Workflows
- Saudi & UAE Bilingual Tax Invoices & Procurement Schedules: Extract line items, quantities, 15% KSA VAT / 5% UAE VAT columns, and SAR/AED totals into Excel—and verify Saudi QR payloads via our free ZATCA QR code scanner or POST /v1/invoice.
- Multi-Page GCC Bank & Credit Card Statements: Stitch 5–20 page bilingual transaction tables with
stitch_tables=trueso continuation pages merge cleanly into a single worksheet without repeated Arabic/English headers. - Construction BOQs, Customs Packing Lists & Supplier Catalogs: Keep SKU codes, units of measure, and bilingual item descriptions in aligned columns without maintaining brittle per-vendor column coordinate templates.
- Clean Arabic CSV Export Without Excel Mojibake: Export directly to multi-sheet
.xlsxor RFC-4180 CSV with UTF-8 BOM (utf-8-sig) so finance teams in Riyadh, Dubai, and Cairo can double-click files straight into Microsoft Excel.
Python Implementation: Arabic PDF Tables to Excel (.xlsx) & UTF-8 BOM CSV
Call POST https://api.structocr.com/v1/pdf-extract with mode=tables and stitch_tables=true, coerce numeric strings into real Excel numbers, and optionally toggle RTL sheet direction via openpyxl. Full API contract details live in the PDF Extract API docs.
Prerequisite: Python 3.9+ (`pip install requests openpyxl`; no Java/JVM or Tesseract needed)
import csv
import os
import re
import requests
from openpyxl import Workbook
NUMERIC_RE = re.compile(r"^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?$|^-?\d+(?:\.\d+)?$")
def to_excel_cell(value: str):
text = (value or "").strip()
if NUMERIC_RE.match(text):
cleaned = text.replace(",", "")
return float(cleaned) if "." in cleaned else int(cleaned)
return text
with open("arabic_bilingual_schedule.pdf", "rb") as pdf_file:
response = requests.post(
"https://api.structocr.com/v1/pdf-extract",
headers={"x-api-key": os.environ["STRUCTOCR_API_KEY"]},
files={"file": ("arabic_bilingual_schedule.pdf", pdf_file, "application/pdf")},
data={
"mode": "tables",
"pages": "all",
"stitch_tables": "true",
},
timeout=90,
)
response.raise_for_status()
tables = response.json()["document"]["tables"]
wb = Workbook()
wb.remove(wb.active)
for idx, table in enumerate(tables, start=1):
# 1) Write native multi-sheet Excel (.xlsx) with real numeric cells
ws = wb.create_sheet(title=f"Table_{idx}")
ws.views.sheetView[0].rightToLeft = True # Optional: RTL sheet view for Arabic-first teams
ws.append(table["headers"])
for row in table["rows"]:
ws.append([to_excel_cell(cell) for cell in row])
# 2) Write UTF-8 with BOM CSV so Microsoft Excel opens Arabic without mojibake
with open(f"arabic_table_{idx}.csv", "w", newline="", encoding="utf-8-sig") as f:
writer = csv.writer(f)
writer.writerow(table["headers"])
writer.writerows(table["rows"])
wb.save("arabic_tables.xlsx")
print(f"Saved {len(tables)} stitched table(s) to arabic_tables.xlsx")Technical Specs
- •Endpoint: `POST https://api.structocr.com/v1/pdf-extract` (`mode=tables` or `mode=auto`)
- •Multi-Page Stitching: Deterministic header matching (`stitch_tables=true`) merges continuation tables across up to 20 pages per call
- •Bilingual & RTL Layout: Preserves Arabic + English column alignment on gridded, semi-bordered, and borderless PDFs
- •Numeral Normalization: Normalizes Eastern Arabic-Indic digits (`٠١٢٣٤٥٦٧٨٩`) to Western `0-9` digits for Excel math and ERP imports
- •File Limits: Direct binary upload up to 10 MB (digital PDF, scanned PDF, JPG, PNG, WebP)
- •Privacy & Billing: Strict Zero Data Retention (`raw_response: null`); 2 credits per succeeded page with automatic failed-page refunds
Key Features
- •Zero scrambled bilingual headers: Keeps paired headers like `الوصف / Description` intact in one column rather than splitting across adjacent cells.
- •Duplicate continuation headers removed: Repeated page 2–20 headers are stripped automatically when `stitch_tables=true`.
- •Browser Excel (.xlsx) & CSV Workbench: Non-technical analysts can drop a PDF into the PDF to CSV / Excel workbench and download ready-to-open spreadsheets with zero setup.
- •No Java/JVM or Poppler dependencies: Runs cleanly from AWS Lambda, Cloudflare Workers, Vercel, or slim Python/Node containers.
Example Stitched Bilingual Arabic–English Table Response (Synthetic Specimen)
Synthetic `POST /v1/pdf-extract` (`mode=tables`, `stitch_tables=true`) response merging a 2-page bilingual Riyadh procurement schedule into one clean `table_1` array.
{
"success": true,
"mode": "tables",
"document": {
"summary": {
"document_type": "procurement_schedule",
"title": "جدول الكميات والأسعار / Bilingual Procurement Schedule (Synthetic Sample)",
"language": "ar"
},
"fields": {},
"tables": [
{
"id": "table_1",
"title": "بنود التوريد / Supply Line Items",
"page_range": [
1,
2
],
"stitched": true,
"headers": [
"الرمز / SKU",
"الوصف / Description",
"الكمية / Qty",
"سعر الوحدة / Unit Price (SAR)",
"الإجمالي / Total (SAR)"
],
"rows": [
[
"KSA-101",
"خادم تخزين شبكي — Rackmount Storage Server",
"4",
"8,500.00",
"34,000.00"
],
[
"KSA-102",
"وحدة طاقة احتياطية — Industrial UPS 3kVA",
"6",
"1,950.00",
"11,700.00"
],
[
"KSA-204",
"كابل ألياف ضوئية — Single-Mode Fiber Patch 20m",
"25",
"140.00",
"3,500.00"
],
[
"KSA-309",
"خدمة التركيب والاختبار — On-Site Commissioning",
"1",
"4,200.00",
"4,200.00"
]
]
}
]
},
"custom_data": null,
"pages": [
{
"page": 1,
"status": "ok",
"tables_found": 1
},
{
"page": 2,
"status": "ok",
"tables_found": 1
}
],
"usage": {
"page_count": 2,
"pages_processed": 2,
"pages_succeeded": 2,
"credits_per_page": 2,
"credits_charged": 4
}
}Frequently Asked Questions
Why does Microsoft Excel turn Arabic CSV text into garbled symbols?
Microsoft Excel assumes a `.csv` file without a UTF-8 Byte Order Mark (BOM) is encoded in a legacy local codepage instead of UTF-8. Writing CSV files with encoding="utf-8-sig" in Python (or prepending \uFEFF in Node.js)—or exporting directly to .xlsx—fixes the issue completely.
Will Eastern Arabic-Indic numbers (٠١٢٣٤٥٦٧٨٩) work in Excel SUM() formulas?
Yes. StructOCR normalizes Eastern Arabic-Indic digits to standard Western digits (0-9) in the JSON response. When building `.xlsx` files with openpyxl or `pandas`, convert numeric strings to Python `int`/`float` as shown above so Excel recognizes them as numeric cells.
Can I extract a 30-page scanned Arabic statement or BOQ?
Each request handles up to 20 pages (within the 10 MB upload limit) with automatic cross-page table stitching. For longer PDFs, send sequential slices such as pages=1-20 and pages=21-30 and concatenate matching tables in your worker.
When should I use POST /v1/pdf-extract vs. POST /v1/invoice for Arabic invoices?
Use POST /v1/pdf-extract for multi-page schedules (up to 20 pages), custom JSON schemas, and raw CSV/Excel table exports. Use POST /v1/invoice when you want a standardized invoice schema (up to 5 pages) plus built-in gcc_compliance validation for Saudi 15-digit VAT, UAE TRN, and ZATCA TLV QR cross-checks.
You May Also Like
Related tutorials, platform guides, and comparisons
Convert PDF to JSON in C# & .NET – Custom Schema OCR API
Extract structured JSON and custom JSON schemas from scanned or digital PDFs in C# and ASP.NET Core using MultipartFormDataContent and POST /v1/pdf-extract.
Extract Table from PDF to CSV in Node.js – Scanned PDF Table API
Convert scanned and multi-page PDF tables into RFC-4180 UTF-8 CSV files in Node.js 18+ and TypeScript via POST /v1/pdf-extract without native binary dependencies.
Extract Table from PDF to CSV in PHP & Laravel – PDF Table OCR API
Convert scanned and digital PDF tables into Excel-ready UTF-8 CSV files in PHP 8+ using CURLFile, fputcsv, and POST /v1/pdf-extract.
Convert PDF to JSON in PHP & Laravel – Custom Schema OCR API
Convert scanned and digital PDFs to structured JSON in PHP 8+ and Laravel using CURLFile and POST /v1/pdf-extract. Supports custom JSON schemas and 10 MB binary uploads.
Extract Table from PDF to CSV in Go (Golang) – PDF Table OCR API
Extract multi-page and scanned PDF tables to CSV in Go using standard library mime/multipart and encoding/csv with POST /v1/pdf-extract.
Arabic RTL PDF OCR – Tesseract & PyPDF2 Alternative
Stop fighting reversed Arabic text in PyPDF2 and broken cursive lines in Tesseract. Extract clean UTF-8 JSON and stitched tables from scanned Arabic & bilingual PDFs via POST /v1/pdf-extract.
Go National ID OCR API
Upload an image for a free test! High-accuracy National ID data extraction for Go developers. Get structured JSON output via a simple API call, replacing unreliable open-source tools.
Go Passport OCR API
Upload an image for a free test! Extract passport data via a simple REST API in Go. Get high-accuracy, ICAO-compliant JSON output from noisy images. Eliminate manual entry errors.
Go Receipt OCR API
Upload an image for a free test! Tutorial: Build scalable expense reporting apps in Go. Learn how to extract merchants, line items, and totals from POS receipts using our Golang OCR integration.
Go Weighbridge Ticket OCR API Tutorial
Build a Go weighbridge ticket OCR client. Send Base64 images and parse vehicle, material, gross, tare, net, and weight validation results.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Add Passport OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a v0 by Vercel app through a secure Next.js server route.
Add Receipt OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR receipt API into a v0 by Vercel app. Build expense tracking and receipt scanning tools right in your browser.
Add VIN OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR VIN scanner API into a v0 by Vercel app. Build automotive and fleet tools with zero backend.
VIN Barcode Scanner vs. VIN OCR API: Which is Better for Mobile Apps?
Deciding between local VIN barcode scanners and cloud-based VIN OCR API for your mobile app? Learn why OCR is the required fallback for damaged or chassis-stamped VINs.
Apple Vision Framework / ML Kit vs. StructOCR VIN API
Why generic on-device text recognition frameworks fail at decoding VINs, and when to switch to a specialized automotive API.
AWS Textract vs. StructOCR API for Indian Passport Back Page Extraction
Why generic OCR fails at parsing the back page of Indian passports, and how a dedicated KYC API instantly extracts structured addresses, PIN codes, and family details.
n8n Image to Excel OCR Workflow – Photo to Sheets
Configure an n8n workflow that converts JPG, PNG, and WebP table photos into Excel (.xlsx) files or Google Sheets rows using one HTTP Request node to POST /v1/image-to-excel with zero data retention.
From tutorial to production in 5 minutes.
You've seen the code. Now get your API key, grab your 200 free credits, and see it work with your own images. No credit card required.