PDF and Image Table Extractor (CSV, Excel, Markdown)
Pricing
from $4.00 / 1,000 processed pages
PDF and Image Table Extractor (CSV, Excel, Markdown)
Finds ruled tables in PDFs and scanned images (PNG, JPG, TIFF) and returns one dataset item per table, plus CSV, Excel and Markdown files. Scans are read with built-in OCR in six languages. Source files are never stored; logs hold counts only. Pay per page, only for files that produced a table.
Pricing
from $4.00 / 1,000 processed pages
Rating
0.0
(0)
Developer
jeenopylo
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
16 days ago
Last modified
Categories
Features
Share
PDF and Image Table Extractor (CSV, Excel, Markdown)
Finds the tables in PDF files and in scanned images (PNG, JPG, TIFF) and returns them as one dataset item per table, one CSV file per table, one Excel workbook with a sheet per table and one Markdown file. Pages with a text layer are read directly; scanned pages and images are read with built-in OCR. The actor detects tables drawn with ruled lines (a grid). It does not detect tables made only of aligned columns of text, does not fill in forms, and does not keep or log the documents it reads.
Why use this actor
- Three output formats from one run. Every table is a dataset item (
rowsandmarkdown), a CSV file, a sheet intables.xlsxand a section intables.md. - Text PDFs and scans in one actor. PDF pages with a text layer are read exactly, with no OCR and no OCR charge. Scanned pages and image files go through Tesseract OCR in English, German, French, Spanish, Italian or Portuguese.
- Documents are not kept. Files are downloaded into memory, read there and dropped. Nothing about a document is logged beyond counts and page numbers (see Privacy).
- No charge for files without tables. Both events are charged only for files that produced at least one table. A run where no file yields a table ends as failed, with the reason, and no page is charged.
- Bounded runs. Maximum pages per run (up to 200) and maximum file size (up to 50 MB) are inputs, and the run's maximum cost is respected before every file.
Input
| Field | Type | Description |
|---|---|---|
sources | list of text | Links to PDF, PNG, JPG or TIFF files, up to 50. The file type is read from the file itself. The prefill is two synthetic samples: a PDF with text tables and a PNG scan. |
ocrMode | auto, always, off | auto (default) reads PDF pages without a text layer, and all images, with OCR. always runs OCR on every PDF page, even pages with text. off never runs OCR: images are skipped and scanned pages give no tables. |
ocrLanguage | eng, deu, fra, spa, ita, por | Language of the text in scans. One language per run. Default eng. |
maxPages | integer | Pages processed in one run, counted over all files in order, 1 to 200. Default 200. Pages beyond the limit are not processed and not charged. |
maxFileMb | integer | Largest file accepted, 1 to 50 MB. Default 50. Larger files are skipped and named in the summary. |
Output
Each dataset item is one table:
| Field | Description |
|---|---|
sourceName | File name of the document, without the query string of its link. |
page, tableIndex | Page number (from 1) and the table's number on that page (from 1, top to bottom). |
method | text for a table read from a PDF text layer, ocr for a table read from a picture. |
nRows, nCols | Size of the table. A table has at least 2 rows and 2 columns. |
rows | The cells as a list of rows, each a list of text. Empty rows and empty columns are dropped, line breaks inside a cell become spaces. |
markdown | The same table as a Markdown pipe table. The first row is the header. |
The key-value store of the run holds the same tables as files:
| Key | Content |
|---|---|
table-p<page>-<n>.csv | One CSV file (UTF-8) per table. With several files in a run the key is table-s<file number>-p<page>-<n>.csv. |
tables.xlsx | One Excel workbook, one sheet per table (p1-t1, or s2-p1-t1 with several files). Every cell is text exactly as read: nothing is turned into a number or a date and formulas are never evaluated. |
tables.md | Every table as Markdown under a heading with its file name, page and table number. |
SUMMARY | Counts per file (pages, pages processed, OCR pages, tables, failed pages, skipped files and why) and for the run (pages and OCR pages actually charged, whether OCR scratch files were kept in /dev/shm). It holds no table content. |
Privacy
- In memory. Each file is downloaded into memory and processed there. A source document is never written to the key-value store, the dataset or any other storage. Pictures of pages exist only as the OCR scratch files described next.
- OCR scratch files stay in RAM. Tesseract needs a picture file per page. It is written to a temporary folder under
/dev/shm(memory-backed on Linux) and deleted right after the page. If/dev/shmis not available the default temporary folder is used, this is logged once, and theSUMMARYflagocrTempInShmisfalse. - Logs hold counts and page numbers only. No cell text, recognised text, file name or link is written to the log or to a status message, and error messages from the document libraries are never quoted. File names appear only in the
SUMMARYrecord. - What is stored. The extracted tables are the result, so they are in the run's dataset and key-value store, like the output of any actor. The links in
sourcesare part of the run input that Apify stores. Use short-lived signed links for sensitive documents and delete the run when the tables are no longer needed. - No outside services. OCR runs inside the container with Tesseract. Documents are fetched from the links given and sent nowhere else.
Pricing
This actor uses pay-per-event pricing. Both events are charged only for a file that produced at least one table, and only after its tables are delivered.
| Event | Price | Charged when |
|---|---|---|
page-processed | $0.004 | Once per page read in a file that produced at least one table. Pages of that file without a table count too. |
ocr-page | $0.012 | In addition, once per page read with OCR (a scanned PDF page or an image) in a file that produced at least one table. |
A page read from a text layer costs $0.004. A page read with OCR costs $0.004 + $0.012 = $0.016.
Worked example: three files in one run.
- A 10-page text PDF with tables on 4 pages: 10 x $0.004 = $0.04 (all 10 pages are charged, because the file produced tables).
- A 3-page scanned PDF with a table on each page: 3 x $0.004 + 3 x $0.012 = $0.048.
- A 5-page PDF with no ruled tables: nothing is charged, the file produced no table.
Total: $0.04 + $0.048 = $0.088. A run in which no file produces a table fails and no page is charged. Pages that fail to read, and pages left out by maxPages or by the run's maximum cost, are not processed and not charged. A file that cannot be downloaded or read is skipped and not charged.
Apify's standard apify-actor-start event also applies to every run, at $0.00005 per GB of run memory, so $0.0001 at the default 2 GB. It is left out of the example. The run's maximum cost is priced page by page, with an OCR page counted at both of its events ($0.016): a page is read only if the money left in the limit pays for it, so a run never delivers pages it cannot charge. For example, a maximum cost of $0.10 pays for 6 OCR pages ($0.096) or 25 text pages. The limit is read again before every file, and a scan that no longer fits is skipped while a cheaper text page after it can still be read. The status message and the SUMMARY fields pagesCharged and ocrPagesCharged report what was actually charged.
FAQ
Which tables are detected? Tables drawn with ruled lines, in PDF text layers and in pictures. Tables that are only aligned columns of text, without ruled lines, are not detected: guessing them also finds "tables" in ordinary paragraphs, and a wrong table would be charged. A file with only such tables produces no table and costs nothing.
How accurate is the OCR?
It depends on the scan: resolution, skew, contrast and the language setting all matter. PDF pages are rendered at 300 dpi, and the ruled lines are painted out of the picture before the text is read, because Tesseract cannot read text inside a grid. Check recognised numbers before relying on them; the method field tells text-layer tables from OCR tables.
Why was a file not charged?
Either it produced no table, or it could not be downloaded or read (not a PDF or image, password-protected, over maxFileMb, or corrupt). The SUMMARY record names each file with its status and reason.
A scanned PDF gave no tables with ocrMode set to off. Why?
With OCR off only the text layer is read, and a scan has none. The failed run's message says how many pages had no text layer. Use auto.
What about PDFs that were already OCR'd (scans with a hidden text layer)?
Their ruled lines are part of the picture, not of the PDF, so the text layer alone shows no table. Use ocrMode always to read every page as a picture.
How long does a run take? Text-layer pages are fast: 60 pages from 30 files took 17 seconds in a test. OCR is slower: 15 scanned pages took 65 seconds at the default 2048 MB of memory, about 4 seconds a page, so a 200-page scan needs roughly 15 minutes. Peak memory was 82 MB for text pages and 347 MB for OCR on Letter-size pages at 300 dpi. Pages larger than 30 megapixels are rendered at a lower resolution. Image files above 50 megapixels are refused; a 50-megapixel photo needs about 1.5 GB of memory before OCR starts, which is why the actor asks for at least 2048 MB.
What happens with a multi-page TIFF?
Each frame is one page, counted against maxPages and charged like any other page.
How do pages with several tables behave? Every table is its own item, numbered from the top of the page. A page is charged once, whatever the number of tables on it.
Disclaimer
This actor is not affiliated with, endorsed by or sponsored by Microsoft Corporation. Excel is a trademark of Microsoft Corporation and is named only to describe the file format. OCR uses the open-source Tesseract engine. Users are responsible for having the right to process the documents they submit and for the lawful use of the extracted data.
Report issues
Report problems or request features in the Issues tab of this actor. Please describe the problem without attaching documents that contain personal or confidential data.