Tool

Extract Tables from PDF Documents into Structured Data

LlamaIndex reader that extracts tables from specific pages of a PDF.

Works with llamaindexcamelot

72
Spark score
out of 100
Updated 2 days ago
Version 0.14.23

Add to Favorites

Why it matters

Users hire this asset to programmatically extract tabular data from specific pages of PDF documents and convert them into structured formats that can be indexed, queried, and processed by LlamaIndex data pipelines.

Outcomes

What it gets done

01

Parse PDF files and identify tables on specified pages

02

Extract table data using page patterns like ranges or comma-separated lists

03

Convert extracted tables into LlamaIndex document format

04

Load structured table data into data pipelines for downstream processing

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-reader-readers-pdf-table | bash

Overview

PDF Table Loader

The PDF Table Loader extracts tables from specific pages of a PDF into LlamaIndex documents, using camelot's page-selection syntax to target which pages to read. Use it when you need tabular data from specific PDF pages loaded into LlamaIndex. It requires knowing which pages contain the tables you want.

What it does

The PDF Table Loader reads the tables included in a PDF. You give it a PDF file and the pages you want, and it extracts the tables found on those pages.

When to use - and when NOT to

Use it when you need tabular data from specific pages of a PDF pulled into LlamaIndex documents. The pages parameter follows the same syntax as the camelot library's pages argument -- all, 1,2,3, 10-20, and similar patterns -- so it is not usable without knowing which pages contain the tables you want.

Inputs and outputs

Install with:

pip install llama-index-readers-pdf-table

Point it at a PDF file and a page range:

from llama_index.readers.pdf_table import PDFTableReader
from pathlib import Path

reader = PDFTableReader()
pdf_path = Path("/path/to/pdf")
documents = reader.load_data(file=pdf_path, pages="80-90")

load_data takes a file (the PDF path) and a pages string in camelot's page-selection syntax, returning the tables found on those pages.

Who it's for

Developers building LlamaIndex pipelines that need tabular data extracted from specific pages of a PDF.

Source README

PDF Table Loader

pip install llama-index-readers-pdf-table

This loader reads the tables included in the PDF.

Users can input the PDF file and the pages from which they want to extract tables, and they can read the tables included on those pages.

Usage

Here's an example usage of the PDFTableReader.
pages parameter is the same as camelot's pages. Therefore, you can use patterns such as all, 1,2,3, 10-20, and so on.

from llama_index.readers.pdf_table import PDFTableReader
from pathlib import Path

reader = PDFTableReader()
pdf_path = Path("/path/to/pdf")
documents = reader.load_data(file=pdf_path, pages="80-90")

Example

This loader is designed to be used as a way to load data into LlamaIndex.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.