DEV Community

Craig George
Craig George

Posted on

How to Get a Table Out of a PDF Without Uploading the File

Bank statements, invoices and supplier price lists often arrive as PDFs. When you need the numbers in a spreadsheet, the usual advice is to upload the file to an online converter. For anything containing account numbers, client names or pricing, that's a real privacy cost. Here's how to do it without sending the file anywhere.

Why copy-paste rarely works

A PDF doesn't store a table as rows and columns. It stores each piece of text at an exact position on the page. When you copy and paste into Excel, those positions are lost, so columns merge, descriptions split across rows, and numbers land in the wrong cells.

To get a usable grid, a tool has to rebuild the table from those positions: group characters that share a baseline into rows, then find the vertical gaps of white space that separate one column from the next.

First check: is your PDF text-based?

Try selecting a single word in the PDF with your cursor. If you can highlight individual words, the PDF contains real text and can be converted directly. If the whole page highlights as one image, it's a scan. Scans need OCR (optical character recognition) first to turn the image into text, and you should check OCR output carefully: it often confuses 0 and O, 1 and I, and drops decimal points or minus signs.

Converting in the browser

PDFtoGrid is a free tool I built that does the table reconstruction in your browser. The PDF is read by JavaScript on the page itself, so the file isn't sent to a conversion server. That matters when the document is a payroll run or a client's statement.

The process is:

  1. Load the PDF. Drop it onto the page or choose the file.
  2. Pick the pages. Use a page range (for example 2-9, or 1,4,11) to skip cover and terms pages.
  3. Check the preview. The extracted table appears as an editable grid. Click any cell to fix a value.
  4. Adjust column spacing. If two columns have merged, lower the spacing value. If one column has split in two, raise it.
  5. Combine pages if needed. For a statement that runs over several pages, you can combine them into one table and skip repeated headers and footers.
  6. Download. Export as XLSX or CSV, or copy to the clipboard.

There's no signup, page limit or watermark.

Always sanity-check the totals

Whatever tool you use, check the result before you rely on it. The simplest test is to add up a column and compare it with the total printed on the original. For an invoice, check that each line's quantity times its price equals the line total. A two-minute check catches the occasional misread before it ends up in your accounts.

The short version

  • Copy-paste breaks tables because PDFs store positions, not cells.
  • Check that the PDF is text-based; scans need OCR first.
  • An in-browser converter keeps sensitive files on your own device.
  • Adjust column spacing until each column lines up.
  • Always check totals against the original.

Top comments (1)

Collapse
 
ptrgiang profile image
Giang Pham Truong •

One export check I'd add alongside totals is preserving identifiers as text. A reference such as 00123 can become 123 when a CSV is opened in a spreadsheet, even when the extracted grid looked correct and every amount still adds up. A small fixture with leading-zero references, a multi-line description, and a repeated page header would let you check the exported file after reopening it: same row count, same identifiers, same amounts. That tests the handoff into the spreadsheet as well as the PDF extraction. I haven't tested PDFtoGrid; this is a suggested validation case.