Prompt

How do I turn unstructured PDFs into rows and columns?

Technology / Data Infrastructure2 observationsLast seen Oct 13, 2026

Latest observation

Oct 13, 2026OpenAI APIWeb search: off

To turn unstructured PDFs into rows and columns, you typically need a PDF extraction pipeline rather than a single tool. The best approach depends on what kind of PDF you have:

1) First identify the PDF type

A. Text-based PDFs

The PDF contains selectable text. These are easier to extract.

  • Use tools like:
    • Tabula
    • Camelot
    • pdfplumber
    • PyMuPDF / fitz

B. Scanned/image PDFs

The PDF is just images of pages. You need OCR first.

  • Use:
    • Tesseract
    • AWS Textract
    • Google Document AI
    • Azure Form Recognizer
    • Adobe PDF Extract API

2) Common extraction workflows

If tables are already visible in the PDF

Use a table extractor:

  • Tabula: good for simple tables
  • Camelot: good for structured tables, supports lattice/stream modes
  • pdfplumber: more flexible for custom parsing

Example with Camelot:

import camelot

tables = camelot.read_pdf("file.pdf", pages="1-end", flavor="stream")
tables[0].df.to_csv("output.csv", index=False)

If the PDF is messy or unstructured

You usually need a pipeline like:

  1. Extract text
  2. Detect layout (headers, paragraphs, tables, columns)
  3. Use rules or ML to identify records
  4. Normalize into a schema
    Example columns: date, vendor, amount, description

Tools:

  • pdfplumber for coordinates and text blocks
  • LayoutParser for document layout detection
  • OCR + document AI for scans

3) If the PDF is invoices, statements, or forms

These are often best handled by document AI tools:

  • AWS Textract
  • Google Document AI
  • Azure Form Recognizer

They can return:

  • key-value pairs
  • tables
  • bounding boxes
  • extracted text by page

This is often much easier than writing custom logic.


4) If the document is highly unstructured

For reports, research papers, legal docs, etc.:

  • Extract text with positions
  • Split by section headers
  • Use regex or NLP to pull fields
  • Manually validate and clean

You may need:

  • LLMs to classify sections or map text into structured fields
  • post-processing scripts to create rows

5) Example: extracting text and turning repeated patterns into rows

If your PDF has repeated records, you can often use regex.

Example:

import re
import pandas as pd
from pdfplumber import open as pdfopen

rows = []

with pdfopen("file.pdf") as pdf:
    for page in pdf.pages:
        text = page.extract_text()
        matches = re.findall(r"(\d{2}/\d{2}/\d{4})\s+(.+?)\s+\$?([\d,]+\.\d{2})", text)
        for date, desc, amount in matches:
            rows.append([date, desc, amount])

df = pd.DataFrame(rows, columns=["date", "description", "amount"])
df.to_csv("output.csv", index=False)

6) Best practice

A practical approach is:

  • Text PDF + simple table → Camelot or Tabula
  • Text PDF + complicated layout → pdfplumber + custom parsing
  • Scanned PDF → OCR or Document AI
  • Large-scale production → cloud document extraction service

7) Important note

“Unstructured” usually means there’s no perfect automatic solution. You often need:

  • a bit of manual schema design
  • cleanup rules
  • validation of the final rows/columns

If you want, I can help you choose the best method for your specific PDF if you describe:

  1. whether it’s scanned or selectable text
  2. whether it contains tables, invoices, or free-form text
  3. a sample page or screenshot structure

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (2 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.