# Document Text Extractor: PDF, Word, PowerPoint, Excel (`klyve1/document-text-extractor`) Actor

Extract the text of PDF, DOCX, PPTX, XLSX, ODT, ODP and ODS files from URLs: clean text, word count, page count, metadata and optional chunks for LLM and RAG pipelines. Native text, no OCR.

- **URL**: https://apify.com/klyve1/document-text-extractor.md
- **Developed by:** [Nico Klyve](https://apify.com/klyve1) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 document extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Document Text Extractor: PDF, Word, PowerPoint, Excel

Turn **PDF, Word, PowerPoint, Excel and OpenDocument files** into clean text or Markdown in one run. Give a list of file URLs and get, for each document, its full text, word and character counts, page or slide count, author and dates, and optional **ready-to-embed chunks** for LLM and RAG pipelines.

It reads the native text layer of the file, so it is fast and cheap. For scanned documents (images only), use [PDF & Image OCR](https://apify.com/klyve1/pdf-image-ocr).

### Who uses it

- **AI and RAG builders**: feed PDFs, decks and spreadsheets to an LLM or a vector database, already chunked with page numbers and headings for citations.
- **Data and research teams**: pull the text of reports, papers and public documents for search, classification or summarisation.
- **Automation (Make, Zapier, n8n)**: convert files that arrive by email or in a shared folder into text for the next step.
- **Content and SEO teams**: count words and extract the content of documents in bulk.

### Supported formats

PDF, DOCX, PPTX, XLSX, ODT, ODP, ODS, RTF, EPUB, CSV, Markdown and plain text. The type is detected from the extension, the content type or the file itself.

### Example output

```json
{
  "url": "https://raw.githubusercontent.com/harshankur/officeParser/master/test/files/test.pptx",
  "fileType": "pptx",
  "fileSizeBytes": 89059,
  "title": null,
  "author": null,
  "created": "2025-11-25T16:36:03.000Z",
  "modified": "2025-12-07T10:15:57.000Z",
  "pageCount": 9,
  "characterCount": 7905,
  "wordCount": 1113,
  "truncated": false,
  "format": "text",
  "text": "Demonstration of DOCX support in calibre\nThis document demonstrates the ability of the calibre DOCX Input plugin to convert the various typographic features...",
  "error": null
}
```

With `chunkSize` set (for example 1500), each row also gets `chunkCount` and a `chunks` list:

```json
{ "index": 0, "text": "Trace-based Just-in-Time Type Specialization for Dynamic Languages\n\nAndreas Gal, Brendan Eich, ...", "page": 1, "sheet": null, "heading": null }
```

`pageCount` is the number of pages (PDF), slides (PPTX, ODP) or sheets (XLSX, ODS) when the format has them.

### Input

| Field | What it does | Default |
|---|---|---|
| `documentUrls` | Direct links to the files, one per line, up to 50 MB each | required |
| `outputFormat` | `text` (plain text, tables laid out) or `markdown` (headings, lists and tables in Markdown) | text |
| `chunkSize` | When above 0, also split each document into chunks of at most this many characters, along paragraphs, pages, slides and sheets | 0 |
| `maxCharacters` | Cap on the text kept per document (0 = no limit) | 0 |

### Pricing

Pay per result: **$0.002 per document with text extracted**. Files that fail to download, password-protected files and documents without a text layer are free.

### Good to know

- No OCR: scanned PDFs come back with an empty text and a warning. Use [PDF & Image OCR](https://apify.com/klyve1/pdf-image-ocr) for those.
- Links must be direct downloads (the response must be the file itself, not a viewer page). Public cloud links usually need their "direct download" form.
- Files are processed in memory and are not stored by the Actor. Only use documents you have the right to process.

# Actor input Schema

## `documentUrls` (type: `array`):

Direct links to the files, one per line (up to 50 MB each). Supported: PDF, DOCX, PPTX, XLSX, ODT, ODP, ODS, RTF, EPUB, CSV, Markdown and plain text. The type is detected from the extension, the content type or the file itself.

## `outputFormat` (type: `string`):

text = plain text with tables and lists laid out. markdown = headings, lists and tables in Markdown, handy for LLM prompts.

## `chunkSize` (type: `integer`):

Optional. When above 0, the text is also split into chunks of at most this many characters, along paragraphs, pages, slides and sheets, each with its page or slide number and closest heading. 0 = no chunks.

## `maxCharacters` (type: `integer`):

Optional cap on the text kept for each document (0 = no limit). Counts and chunks still cover the whole document.

## Actor input object example

```json
{
  "documentUrls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://raw.githubusercontent.com/harshankur/officeParser/master/test/files/test.pptx"
  ],
  "outputFormat": "text",
  "chunkSize": 0,
  "maxCharacters": 0
}
```

# Actor output Schema

## `results` (type: `string`):

All rows produced by the run.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "documentUrls": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
        "https://raw.githubusercontent.com/harshankur/officeParser/master/test/files/test.pptx"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("klyve1/document-text-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "documentUrls": [
        "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
        "https://raw.githubusercontent.com/harshankur/officeParser/master/test/files/test.pptx",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("klyve1/document-text-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "documentUrls": [
    "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
    "https://raw.githubusercontent.com/harshankur/officeParser/master/test/files/test.pptx"
  ]
}' |
apify call klyve1/document-text-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,klyve1/document-text-extractor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/lnJeGLFbq2dIxg0cM/builds/Ui7wFS8dMcOdztiuc/openapi.json
