Skip to main content
This guide walks through extracting tables from a folder of documents (scanned pages, PDFs, historical records) and saving every table cell to one CSV file you can open in a spreadsheet or load into R. Table extraction runs as an async feature: you start a job, then poll for its result. The workflow is always the same three steps, repeated for each document:
  1. Upload the file to get a file_id — or skip the upload and pass a public file URL directly as the file input in step 2.
  2. Launch a table-extraction job with POST /v3/universal-ai/async, which returns a public_id.
  3. Poll GET /v3/universal-ai/async/{public_id} until the job’s status is success, then read its output.

Prerequisites

  1. API Token — get yours from the Eden AI dashboard.
  2. Credits — table extraction is billed per page (see pricing below). To try the flow for free first, use a sandbox token.
  3. For R: the httr and jsonlite packages (install.packages(c("httr", "jsonlite"))).

Model string

Table extraction uses the Universal AI model format feature/subfeature/provider:
Pick the provider from the table belowamazon, google, or microsoft.

A single document, end to end

Start with one file to see the shape of the calls. This uploads a document and launches the job; the launch response contains the public_id you poll on.

Response shape

A completed job returns a status and an output. Tables are nested pages -> tables -> rows -> cells, and each cell carries its position (row_index, col_index) so you can rebuild the grid:

Batch a whole folder into one CSV

Now loop the three steps over a list of files. Each document is uploaded, launched, and polled independently; every cell is flattened into a row tagged with its source file, page, and table, then written to tables.csv. The poll loop is bounded — it gives up after a fixed number of attempts rather than waiting forever — and a failed or slow document is skipped rather than aborting the whole batch.
Prefer not to poll? Pass an HTTPS webhook_receiver when you launch the job and Eden AI will POST each result to your server as it finishes — see Webhooks for the payload shape and a poll-vs-webhook comparison. Polling is simplest for a one-off batch; webhooks scale better for large or ongoing workloads.

Reading the CSV in R

Once tables.csv is written, it loads like any other data frame:
R

Choosing a provider

All three providers return the same standardized shape, so you can switch by changing only the provider in the model string. They differ in price and in how they handle dense or low-quality scans — worth testing a few of your own pages against each.

Expert OCR vs. an LLM

Table extraction (ocr/ocr_tables_async) is a specialized OCR model: it returns every cell with its row/column position and a confidence score, and it’s priced per page. That structure is what makes the CSV step above reliable. An LLM can also read a document and return data, and it’s more flexible when you want to reshape or interpret the content in the same pass (for example “return each row as JSON with typed fields”). It’s usually the better fit when the layout varies a lot or you need reasoning over the values, but it does not give you per-cell coordinates or confidences, and cost scales with tokens rather than pages. If you’re deciding between the two for a table-heavy workload, see:

LLMs vs. Expert Models

When to reach for a specialized model versus a general LLM.

Structured Output

Force an LLM to return typed JSON matching your schema.

Next Steps

Table Extraction Reference

Full input/output schema for ocr_tables_async.

File Upload

Upload once, reference a file across many requests.

Webhooks

Get async results pushed to you instead of polling.

OCR Features

Text detection, multipage OCR, and document parsers.