Read Legacy Office Documents for AI
LlamaIndex reader that parses legacy .doc Office files via a locally-run Apache Tika server.
Why it matters
Ingest and process data from legacy Microsoft Office documents (.doc) for use in AI applications. This reader enables AI models to access and understand information previously locked in older file formats.
Outcomes
What it gets done
Parse .doc files using Apache Tika.
Extract text content and metadata from legacy Office documents.
Integrate seamlessly with LlamaIndex for RAG and data pipelines.
Run Tika server locally for secure, offline processing.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-reader-readers-legacy-office | bash Overview
LlamaIndex Legacy Office Reader
A LlamaIndex reader that parses legacy .doc Word files by running a local Apache Tika server, integrating with SimpleDirectoryReader. Use for old .doc-format Word files that modern readers can't parse; not needed for .docx files or Java-restricted environments.
What it does
Legacy Office Reader loads data from legacy Office documents - Word 97 .doc files - using Apache Tika. By default it runs the Tika server locally rather than calling a remote server, avoiding an external dependency.
pip install llama-index-readers-legacy-office
When to use - and when NOT to
Use it when a corpus includes old .doc-format Word files that modern Office readers can't parse directly. It integrates with SimpleDirectoryReader via a file_extractor mapping, so .doc files in a directory are routed to this reader automatically alongside other file types. It is not needed for modern .docx files, which have their own dedicated readers, and it requires a local Java runtime, so it's not suited to environments where installing Java isn't an option.
Inputs and outputs
Input is a path to a .doc file, optionally with a path to a Tika server JAR:
from llama_index.readers.legacy_office import LegacyOfficeReader
### Initialize LegacyOfficeReader
reader = LegacyOfficeReader(
tika_server_jar_path="path/to/tika-server.jar", # Optional: Path to Tika server JAR
)
### Load data from a legacy Office document
documents = reader.load_data(
file="path/to/document.doc", # Path to the legacy Office document
)
Output is a list of Document objects with both extracted content and preserved metadata. Multiple documents can be batch-processed, and it plugs into SimpleDirectoryReader as a .doc file extractor.
Integrations
Built on top of Apache Tika (the content-analysis toolkit) via the tika-python bindings. It requires Java Runtime Environment 11 or higher (needed for Apache Tika 3.x) and Python 3.8 or higher. On first use it downloads the Tika server JAR automatically if one isn't provided, and the local Tika server runs on port 9998; Java 11+ must be installed and available on the system PATH.
Who it's for
Developers building LlamaIndex ingestion pipelines over document archives that still include legacy .doc Word files, who need those files parsed alongside modern formats without standing up a separate remote Tika service.
Source README
LlamaIndex Legacy Office Reader
Overview
The Legacy Office Reader allows loading data from legacy Office documents (like Word 97 .doc files) using Apache Tika. It runs the Tika server locally to avoid remote server calls.
Installation
You can install the Legacy Office Reader via pip:
pip install llama-index-readers-legacy-office
Usage
Basic Usage
from llama_index.readers.legacy_office import LegacyOfficeReader
### Initialize LegacyOfficeReader
reader = LegacyOfficeReader(
tika_server_jar_path="path/to/tika-server.jar", # Optional: Path to Tika server JAR
)
### Load data from a legacy Office document
documents = reader.load_data(
file="path/to/document.doc", # Path to the legacy Office document
)
Using with SimpleDirectoryReader
from llama_index.core import SimpleDirectoryReader
from llama_index.readers.legacy_office import LegacyOfficeReader
reader = SimpleDirectoryReader(
input_dir="path/to/directory/",
file_extractor={".doc": LegacyOfficeReader()},
)
documents = reader.load_data()
Features
- Parses legacy Office documents (
.doc) using Apache Tika - Optionally (default) runs Tika server locally to avoid remote server calls/dependencies
- Extracts both content and metadata from documents
- Supports batch processing of multiple documents
- Seamless integration with SimpleDirectoryReader
Requirements
- Java Runtime Environment (JRE) 11 or higher (required for Apache Tika 3.x)
- Python 3.8 or higher
Notes
- The first time you use the reader, it will download the Tika server JAR file if not provided
- The Tika server will run locally on port
9998 - All document metadata is preserved in the Document objects
- Make sure you have Java 11+ installed and available in your system PATH
- The reader uses Apache Tika 3.x
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.