Extract a table from a PDF page to CSV

Choose the page that holds your table and press Extract table; the tool lines the text up into rows and columns and gives you a table view and a CSV download.

Live demo · real result from this tool

Drop your PDF here

or paste with Ctrl+V · nothing is uploaded · add several to process them in one go

Your result appears here — processed on your device.

Processed on your device — nothing is uploaded.

How to use the PDF table extractor

  1. Drop a PDF onto the box or press Choose a file.
  2. Enter the Page that holds the table (default 1).
  3. Press Extract table.
  4. Check the table view against the PDF, then download it as a CSV or copy the CSV text. Files are named after your PDF, for example statement-page-3.csv.

What it does and when to use it

Bank statements, price lists, timetables and invoices often arrive as PDFs, but you need the figures in a spreadsheet. Copying from a PDF reader usually pastes each row as one jumbled line. This tool tries to restore the grid so each value lands in its own cell.

It is designed for text-based PDFs made by software, where every cell’s text has a known position. For everything else on the page, such as paragraphs and headings, the PDF text extractor is a better fit.

How it works

pdf.js (pdfjs-dist) reads the page’s text layer in your browser. Then the tool works only with positions:

  1. Pieces of text on the same baseline are grouped into lines.
  2. Each line is split into cells wherever the horizontal gap between pieces of visible text is wider than about one character (1.1 × the font size). Space-only pieces are skipped, because pdf.js often stretches one across the whole gap between columns.
  3. A table is a run of three or more nearby lines that each have at least two cells. The lines with the most cells define the column bands.
  4. Every cell goes into the column band it overlaps most. If at least 60% of the rows have two or more filled cells, the run counts as a table. When a page has several, the longest one is used.
  5. Columns that are empty in every row are dropped, and the rows are written as CSV with quotes where a cell contains a comma.

If no table is found, every line of the page is listed instead. A note reminds you to check merged headers and wrapped cells. Nothing is uploaded; pdf.js may download standard font or character-map data from cdn.jsdelivr.net when the PDF needs it.

Worked examples

A statement page with separate cells. On a test statement whose text layer holds every cell as its own piece, with Date, Description, Debit, Credit and Balance columns, the tool returns five columns. The row for 3 September reads 03/09 | Grocery store | 54.20 | | 1,145.80, with the empty Credit cell kept in place, and the header row comes first.

A page with space items between cells. On a 5-row test statement built with a PDF library, pdf.js reports a space item stretching from each cell to the next. The tool skips those, so the four columns come out separately: 03/09 | Grocery store | 54.20 | 1,145.80.

A wrong page number. Asking for page 5 of a 2-page file gives Page 5 is out of range — this PDF has 2 pages.

Limits and tips

  • Cells that wrap onto two lines become two rows. Merge them by hand.
  • Headers that span several columns may land in one column.

Frequently asked questions

Can it read tables from several pages at once?
No, one page per run. For a statement that spans pages, run it for each page and paste the CSV rows together in your spreadsheet.
Why are my column names Column 1, Column 2…?
The tool does not guess which row is the header. The header row from the PDF appears as the first row of data; promote it to a header in your spreadsheet.
What if every row lands in one column?
That happens when a row really is one piece of text, with ordinary spaces typed between the values. Open the CSV in a spreadsheet and use its split-text-to-columns feature, or check the positions with PDF to JSON. Space items that pdf.js adds between separately placed cells are ignored, so they do not merge columns.
Does it work on scanned statements?
Not directly, because scans have no text layer. Run OCR PDF first; the recognised text can then be read, though OCR spacing makes column detection less reliable.
Are the numbers converted?
No. Every cell is text exactly as it appears, such as 1,145.80. Your spreadsheet converts them when you open the CSV.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close