From Messy PDFs to Clean Spreadsheets: Extracting Document Data with AI, No Retyping
Stop retyping invoices and price lists. A practical guide to turning PDFs into structured CSV data with AI chat, from schema prompts to validation.

How many times a month do you receive PDFs that are really just data wearing a document costume: supplier invoices, reimbursement receipts, price lists, scanned survey forms, purchase orders? And how many hours disappear into moving those numbers into Excel? Since AI chats gained the ability to read files and run code, this kind of data-entry work compresses into three steps: upload, prompt, download. What used to eat an entire afternoon now takes minutes, with far fewer typos.
This tutorial walks through the full workflow: choosing the right tool, preparing documents, writing extraction prompts with an explicit column schema, processing many files at once, validating the results, and ending up with a ready-to-use CSV. The examples use the most common business documents: invoices and price lists.
Why Retyping Data Is the Most Wasteful Job You Still Do
The problem isn't just tedium. Copy-pasting a table out of a PDF almost always breaks something: columns merge into one, rows shift, numbers lose their formatting. Manual typing is cleaner but slow and typo-prone — and a single wrong digit in a total column can derail reconciliation for hours.
AI chats with vision and code execution work differently: they "read" the document layout, understand that one number is a unit price and another is a line total, and output structured data you can export as CSV. Work that fits well: invoices, receipts, purchase orders, price lists and product catalogs, scanned survey forms, and tables inside reports. What doesn't fit: documents that must stay intact for legal reasons, such as signed contracts — keep the original and use AI only to copy the data out.
Pick a Tool That Can Read Files and Produce a CSV
The three major assistants all handle this workflow, each with its own strength:
- ChatGPT accepts PDF uploads in the chat, and its data analysis mode runs Python code — so it can process the document and generate a downloadable CSV or Excel file.
- Claude also reads PDFs and can create Excel (.xlsx) or CSV files you download straight from the conversation, thanks to its file-creation feature.
- Gemini reads PDFs from Drive or uploads, and generated tables can be converted directly into Google Sheets — convenient if your team already lives in Workspace.
For scanned PDFs, all three can read images, but scan quality sets the ceiling on accuracy: a blurry, skewed scan hurts results no matter which model you use.
Prepare Documents So They're Easy to Read
Five minutes of preparation saves dozens of minutes of correction:
- Check the PDF type. Open it in a PDF reader; if you can highlight text, it's text-based (easiest to process). If not, it's a scan.
- Separate by document type. Don't mix invoices and receipts in one request; one document type means one schema.
- Name files descriptively, for example
invoice-jan2026-supplierA.pdf— invaluable when you process batches. - Redact sensitive data before uploading: cover card numbers, government IDs, or customer data with a proper redaction tool, not a black box drawn over the image.
- Split huge files. Dozens of pages containing the same table are usually fine; for hundreds of pages, split them into 30–50-page chunks.
Write Extraction Prompts with an Explicit Column Schema
The most common mistake is asking "extract the data from this PDF" with no schema — the output changes every time you run it. A reliable prompt always specifies five things: exact column names and their order, data types and formats, rules for missing values, number normalization rules, and a request to flag anything uncertain.
Here's a real prompt for invoices:
Extract all invoice data from the attached PDF into CSV.
Columns, exactly in this order:
invoice_no, date (YYYY-MM-DD), supplier, item_description,
qty (integer), unit_price (decimal), total (decimal), notes
Rules:
- Strip currency symbols and thousands separators from numbers.
Example: "$1,250.00" becomes 1250.00.
- If a column doesn't exist in the document, leave it empty — never guess.
- In the "notes" column, flag anything unreadable or ambiguous.
- Output only the CSV content, no explanations.
When the table appears, continue: "Save it as a CSV file." ChatGPT and Claude will produce a downloadable file.
Process Many Documents Without Losing Consistency
The workflow only pays off at volume. Upload 5–10 PDFs in a single request and ask for one merged table, not one table per file:
I'm uploading 8 invoices from 3 different suppliers. Extract ALL of them
into ONE CSV table using this schema. Example of a correct row:
file,invoice_no,date,supplier,item_description,qty,unit_price,total,notes
invoice-A.pdf,INV-2041,2026-01-05,Acme Supply,A4 paper 80gsm,40,52000,208000,
Add a "file" column containing the source PDF name for every row.
Use exactly this schema for all documents.
Three habits keep batch results consistent. First, lock the schema from the start and never reorder columns midway. Second, if layouts vary wildly — different suppliers mean different formats — include one example of a correct row as reference; the model will align the rest. Third, validate one batch before uploading the next.
Validate Before the Data Reaches Your Reports
AI extraction is usually accurate, but "usually" is not a word that belongs in financial reports. Four quick checks are mandatory:
- Count the rows. Eight invoices means eight rows (or more if one invoice has multiple items). If the count is off, find what's missing before moving on.
- Cross-check totals. Ask the AI to sum the
totalcolumn and compare it against the summary figures in the original documents. - Sample manually. Open two or three files at random and compare 5–10 fields against the extracted table.
- Treat the
notescolumn as a warning light. Every row flagged as uncertain needs human eyes — one of the biggest payoffs of a good prompt.
For numbers that drive decisions — taxes, payroll, supplier payments — full validation remains a human responsibility. AI speeds up copying; it doesn't take over verification.
Export, Fix Data Types, and Turn Your Prompt into a Template
Download the CSV or XLSX, open it in Google Sheets or Excel, then fix two small things: date columns should be read as dates (not text) and numeric columns stored as numbers. If they aren't, your SUM formulas will quietly return wrong results with no error at all.
Finally, save the proven prompt in a team document. It's the most valuable asset of the whole workflow: the same prompt next week and next month produces the same schema, so data can be combined across periods with no realignment. Once one template prompt is battle-tested, the weekly PDF pile becomes a ten-minute routine.
Copying data from documents into spreadsheets is exactly the kind of work worth delegating to AI, because its rules can be written down explicitly: a fixed schema, written normalization rules, measurable validation. Start this week with the document type you handle most often, test with 5–10 files, and refine the prompt until results are consistent twice in a row. The biggest benefit isn't just reclaimed time — it's clean, consistent data ready to support real decisions.
References
- OpenAI Help Center — Uploading files and audio to ChatGPT — supported file types in ChatGPT
- OpenAI Help Center — Data analysis with ChatGPT — official guide to data files in ChatGPT
- Claude Help Center — Create and edit files with Claude — Claude's CSV/Excel file-creation feature
- Anthropic — Claude can now create and edit files — official announcement of the file-creation feature



