How-to Civil servants, Intermediate, Across government, Data extraction
How to pull data out of documents
Use AI to turn reports, forms and scanned tables into usable lists and spreadsheets and check the numbers before you rely on them.
Last reviewed: . Reviewer: Muhammad Asadullah.
The problem it solves
A great deal of government information sits in documents rather than databases: tables in PDF reports, figures scattered through letters, details on hundreds of application forms, budget annexes, scanned registers. Copying these into a spreadsheet by hand is slow and error-prone. AI can read the document and give you the data as a table you can paste into Excel.
This saves hours. It also introduces a new risk: errors that look neat and believable. Every extracted number must be checked before it informs a decision.
Before you start
- Personal data stays out of public tools. Forms with names, CNIC numbers, phone numbers or addresses must only be processed with tools your department has approved, if at all. See data protection.
- Scans are harder than digital text. A clean digital PDF extracts well. A blurred photocopy or a handwritten register will produce more errors.
Step by step
- Say exactly what to extract. Name the columns you want in order and the format of each (number, date as DD-MM-YYYY, text).
- Ask for a table. Most assistants can return a table you can copy straight into a spreadsheet, or comma-separated text.
- Tell it what to do when unsure. "If a value is unclear or missing, write UNCLEAR. Do not guess." Without this instruction, AI may fill gaps with plausible inventions.
- Check totals. If the document has totals, add up the extracted figures and compare. A mismatch tells you something was misread.
- Spot-check rows against the original. For a long table, check at least the first, last and a few random rows by hand.
- Keep the source. Note which document and page each dataset came from, so anyone can verify it later.
Example instructions
From this PDF report, extract the district-wise table on page 12 into a table with columns: District, Number of schools, Enrolment 2024, Enrolment 2025. Numbers only, no commas. If a value is missing or unclear, write UNCLEAR. Then give the column totals.
These are 20 scanned complaint forms. For each, extract: form number, date received, category of complaint and action requested. Do not extract names or contact details. Return a table with one row per form.
Common mistakes
- Accepting confident numbers. AI may misread a 3 as an 8, or shift a figure into the wrong column and present the result without any warning. See hallucination.
- Losing units. Rupees in thousands versus millions, percentages versus counts. State the unit for every column.
- Skipping rows. Long tables split across pages are a common place for rows to disappear. Compare the row count with the original.
Where this leads
Once data is in a spreadsheet you can sort, filter, chart and compare it. Many assistants can also help you write spreadsheet formulas or explain a trend. Treat any analysis the same way as the extraction: check the numbers it rests on before you put them in a note or a presentation.