When you need CSV from a PDF
CSV is one of the easiest formats to work with.
You can open it in Excel or Google Sheets, import it into a database, or pass it straight into a script. So if a PDF contains data you need to actually work with — transactions, prices, results, inventory or other tabular data — converting it to CSV is often the quickest way to get there.
The problem is that PDFs don’t really have rows and columns in the way a spreadsheet does.
A PDF stores content at positions on a page. Two numbers that appear to be in the same column may simply be positioned next to each other. A description that wraps onto another line may be stored as separate pieces of text.
Recovering the original table means figuring out how those pieces fit together.
PDF to CSV: text rows or real tables?
There’s an important difference between two types of PDF-to-CSV conversion.
Line-based CSV takes the text from the PDF and puts each line into a CSV row. For example:
page,line,text
1,1,Invoice #1042
1,2,Billed to: Acme Co
1,3,Total: 1240.00
This is useful when you want a structured copy of the text rather than a perfectly reconstructed table. It’s also something you can do entirely in your browser with a text-based PDF.
Table extraction is different. Instead of treating every line as a row, it tries to reconstruct the actual table from the PDF:
Date,Description,Amount
2026-08-01,Software subscription,49.00
2026-08-03,Office supplies,127.50
2026-08-05,Travel,84.20
That means identifying columns, matching text to cells, handling wrapped values and stitching tables together when they continue onto another page. This is considerably more complicated than extracting lines of text.
If you just need the contents of a PDF in CSV form, the browser converter is enough. If you need the actual columns from a bank statement, invoice or report, use the API’s table extraction.
Converting bank statements to CSV
Bank statements are one of the most useful examples of why proper table extraction matters.
A typical statement contains something like:
Date Description Money out Money in Balance
01/08/2026 Payment received 2,500.00 5,420.00
03/08/2026 Software Ltd 49.00 5,371.00
05/08/2026 Office supplies 127.50 5,243.50
Getting that into CSV lets you import the transactions into accounting software, reconcile your books, or analyse the data in a spreadsheet.
But bank statements are also particularly easy to get wrong.
Different banks use different layouts. Descriptions can wrap across several lines. Headers and footers appear on every page. Tables can continue across page breaks. And a single missed transaction can make the resulting CSV look perfectly reasonable while being wrong.
That’s why statement extraction needs more than just reading the text.
The API runs a reconciliation check on supported bank statements. It compares the extracted transactions with the opening and closing balances. If the numbers don’t add up, something in the extraction needs attention.
For example, if:
Opening balance
+ money in
- money out
≠ closing balance
the result shouldn’t simply be accepted as correct.
That check gives you a way to catch missing or incorrectly extracted transactions before they make their way into your accounting system.
Convert bank statements to structured data →
PDF to CSV in code
For an occasional PDF, the browser converter is usually all you need.
If you’re processing documents as part of an application or data pipeline, you can use the API instead.
curl -X POST https://api.pdftojson.dev/v1/extract \
-H "Authorization: Bearer $KEY" \
-F file=@statement.pdf -F format=csv
import requests
response = requests.post(
"https://api.pdftojson.dev/v1/extract",
headers={"Authorization": f"Bearer {KEY}"},
files={"file": open("statement.pdf", "rb")},
data={"format": "csv"},
)
csv = response.text
const form = new FormData();
form.append("file", fs.createReadStream("statement.pdf"));
form.append("format", "csv");
const csv = await fetch("https://api.pdftojson.dev/v1/extract", {
method: "POST",
headers: { Authorization: `Bearer ${KEY}` },
body: form,
}).then((r) => r.text());
The API is designed for automated extraction, including table extraction and OCR for scanned documents.
What can go wrong when extracting PDF tables?
PDF tables can be deceptively difficult to extract. A few common problems are worth knowing about.
Scanned PDFs
A scanned PDF is usually an image rather than a document containing selectable text. There are no characters for a normal text extractor to read, so OCR is needed first.
The browser converter works with text-based PDFs. The API can run OCR on scanned documents before extracting the data.
Wrapped cells
A long description might occupy two or three lines on the page while still belonging to a single table cell.
A line-based extractor sees several lines of text. A table extractor needs to recognise that they’re part of the same row.
Merged cells
Reports often contain headings that span several columns or cells that are deliberately left empty. These can make it difficult to determine where the actual column boundaries are.
Tables spanning multiple pages
A table might start halfway down page one and continue onto page two, with the column headings repeated at the top.
The resulting CSV should contain one continuous table rather than treating each page as a separate dataset.
Numbers and currencies
Financial documents contain plenty of values that aren’t quite as simple as they look. For example:
1,240.00
£1,240.00
(1,240.00)
-1,240.00
Depending on how the extraction is handled, these can end up as text rather than numbers. It’s worth checking numeric columns before importing the result into another system.
PDF to CSV vs other tools
There are several ways to get data out of a PDF. The right choice depends on how much control you need.
Excel and Google Sheets
Both can import data from PDFs in some situations. They’re convenient for a quick manual conversion, but results can vary when the document contains wrapped cells, multiple tables or unusual layouts.
Tabula
Tabula is a popular open-source option for extracting tables from PDFs. It’s particularly useful when you’re working with a consistent set of documents and don’t mind selecting or tuning the table extraction yourself.
Camelot
Camelot is another open-source table extraction library, aimed primarily at PDFs with predictable table structures. It’s a good choice when you want to run the extraction yourself and have control over the process.
Chatbots
Uploading a PDF to a chatbot can be useful when you need to work with one document. It’s less suitable when you need a repeatable process, hundreds of files, or a result that can be automatically passed into another system.
The browser converter is useful for quick conversions. The API is there when the extraction needs to become part of a workflow.
Is PDF to CSV private?
Text-based PDFs can be converted in your browser without uploading the file.
Table extraction and OCR use the API, so those files are processed by the service. Check the current API data-retention policy if you’re processing documents containing sensitive information.