How to extract tables from a PDF
Updated
Contents
To extract tables from a PDF, open Extract Tables, add your PDF, press Extract tables, and download the ZIP. Each table it finds comes back as its own CSV file and as its own sheet in one Excel workbook, with the titles and paragraphs around it left out.
It finds tables by where the words sit on the page: words on one line form a row, words set a normal space apart stay in one cell, and columns come from the white space that runs down the rows. There are no settings to choose. It reads only text stored in the PDF as text, so a scanned table needs OCR first.
Extract Tables runs on a secure server, not in your browser, because the word positions come from a native PDF text engine. Your PDF, up to 100 MB, travels over an encrypted connection and is deleted when the job finishes; the download link stops working after 60 minutes. No account is needed.
Step by step
- 1Open the Extract Tables tool. Extract tables works once the status badge reads Secure server.
- 2Drop one PDF on the box that says “Add your PDF, or browse”, or click it to choose the file. A file over 100 MB is refused as soon as you pick it, before anything is sent.
- 3Press Extract tables. Your PDF uploads over an encrypted connection to our secure server, and the button follows the job until the ZIP is back in the page.
- 4When the tables are ready, press Download report-tables.zip, the button named after your file: report.pdf comes back as report-tables.zip. The link stops working after 60 minutes, so save it right away.
- 5Open each sheet beside the page named on its tab, such as Table 1 (p3), and check its rows and columns before you use them.
What counts as a table
A block of lines is kept as a table only when at least two columns each hold something in two or more rows, one column holds short values of fewer than 4 words each and is not mostly bullet items, and no sentence wraps from one row into the next. Titles, captions, paragraph lines and footnotes end a table rather than joining it, so one page can give several tables.
Two columns of prose, side-by-side bulleted lists and letterhead lines fail those tests on purpose. A table whose every column holds longer text can fail them too. If nothing in the file passes, the job ends with a message that no table-like structure was detected, and no ZIP is made.
What you download
The ZIP holds table-1.csv, table-2.csv and so on, one per table, plus tables.xlsx with a sheet per table named by its number and page, such as Table 1 (p3). The CSV files follow the common RFC 4180 layout with no byte-order mark, so a script can read them directly; if accented letters look wrong after a double-click, open the file through Excel's text import.
In tables.xlsx, a cell that holds exactly one number, such as 1,250.00, $4.20, or 15%, is stored as a number, so a formula can add up the column. A code with leading zeros such as 00123, a number of more than 15 significant digits, a European 1.250,00, a date and a negative in brackets stay text, exactly as printed.
Layouts to check by hand
Three layouts trip the detector: two tables side by side on the same rows come out as one wide table, a cell that wraps in the first column ends its table early, and a centred one-line note directly under a table can be taken as its last row. A one-line subheading set in a table's first column also ends it, so a sectioned table can come back as several. Merged header cells are not rebuilt.
Each page is read on its own, so a table that runs over three pages comes out as at least one table per page, with any header row the PDF repeats on each page repeated in each sheet. Stack the sheets and delete the repeated headers to rebuild it.
Extract Tables, PDF to Excel, or OCR first
PDF to Excel puts every line of the PDF's text into one sheet, each value in the column it sits in, which suits getting all of the text into a grid. Extract Tables keeps only the table-shaped blocks, each on its own sheet. Both run on our secure server.
A scanned page has no text to read, so it produces nothing, and a file with no text on any page stops with a message pointing you to OCR PDF. Run it there with the page's language selected, choose a searchable PDF as the result, and bring that file back.
Common questions
Can it extract tables from a scanned PDF?
Not directly. A scan holds a picture of its words, so there are no word positions to read. Run it through OCR PDF first to add a text layer, then extract the tables from the searchable copy, and check the figures, since recognition can misread them.
Why did a page with an obvious table give nothing?
A block counts as a table only when two columns each hold something in two or more rows, one column holds short values of fewer than 4 words, and no sentence runs on from one row into the next. A table of long text, or one cut into single rows by one-line subheadings, can miss those tests.
Will Excel see my numbers as numbers?
Yes, in tables.xlsx, when a cell holds exactly one number such as 1,250.00, $4.20, or 15%. Dates, codes with leading zeros, European-style 1.250,00 and negatives in brackets stay text. The CSV files are plain text, so the program that opens them decides.
Is my PDF uploaded?
Yes. The word positions are read by a native program a browser cannot run, so your PDF travels over an encrypted connection to our secure server, which deletes it when the job finishes. The download link stops working after 60 minutes, and a daily storage rule erases the stored ZIP.
Can I choose which pages to read?
No. There are no options: every page is read. To work on a few pages, make a smaller PDF of them first with Extract Pages, which runs in your browser, and remember that the page numbers on the sheet tabs then count the pages of that copy.