# Word, PowerPoint & EPUB to Text: DOCX, PPTX, ODT (`glistening_film/office-document-text-extractor`) Actor

Extract text, sections and metadata from Word (DOCX), PowerPoint (PPTX), OpenDocument (ODT/ODP) and EPUB files by URL, up to 50 per run. $0.003 per document, no start fee; failed or unsupported files are never charged.

- **URL**: https://apify.com/glistening\_film/office-document-text-extractor.md
- **Developed by:** [Yodesla](https://apify.com/glistening_film) (community)
- **Categories:** Developer tools, AI
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.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

## Word, PowerPoint & EPUB to Text: DOCX, PPTX, ODT

Convert **DOCX, PPTX, ODT, ODP and EPUB** files to clean text by URL, up to 50 per run.
**$0.003 per successfully extracted document, no start fee, failures free.**

### Supported formats

- **docx** — Word (OOXML). Detected by the `word/document.xml` zip member.
- **pptx** — PowerPoint (OOXML). Detected by `ppt/slides/` zip members.
- **odt / odp** — OpenDocument text / presentation. Detected by the zip `mimetype` file.
- **epub** — EPUB 2/3. Detected by the zip `mimetype` file (`application/epub+zip`).

The type is detected from the file's magic bytes and zip member names, never from the URL
extension. Legacy binary **`.doc`/`.ppt`** (OLE2) files return `unsupported_format` with a
message suggesting conversion to `.docx`/`.pptx`; they are not charged.

### What you get

For each URL, one dataset item:

- `status`: `ok`, `download_failed`, `unsupported_format`, `invalid_file`, `empty`, or `error`
- `fileType`: `docx`, `pptx`, `odt`, `odp`, `epub` (null when the file could not be classified)
- `text`: full extracted text (tables rendered as pipe-separated rows when `includeTables` is on)
- `sections[]`:
  - docx: paragraphs grouped by heading (`heading`, `paragraphs`)
  - pptx: one entry per slide (`slide`, `title`, `text`, `notes`)
  - epub: one entry per chapter (`chapter`, `title`, `text`)
  - odt/odp: paragraphs grouped by heading
- `wordCount`, `charCount`, `truncated` (true when `text` was cut at `maxChars`)
- `metadata`: `title`, `author`, `created`, `modified` when the file provides them
- `fileSizeBytes`, `processingMs`, and `error` with a plain-language reason when something fails

### Pricing

**$0.003 per successfully extracted document (`document-extracted` event), no start fee.**
Failed downloads, legacy .doc/.ppt, invalid files and empty documents are reported in the
output but **never charged**. The run checks your spending limit before each file and stops
cleanly when it is reached.

### Limits (by design)

- Max 50 URLs per run; max 50 MB per file; 25-second processing deadline per file; parsing
  runs in a separate process with a 384 MiB memory limit.
- Max 500,000 characters per document (configurable via `maxChars`); longer text is cut and
  marked `truncated`.
- Only public `http(s)` links; local and private-network addresses are refused.
- No OCR, no scanned-document support (these formats are inherently digital).
- Tables are flattened to text rows; no nested structure beyond rows and cells.

### Input example

```json
{
  "urls": [
    "https://raw.githubusercontent.com/python-openxml/python-docx/master/tests/test_files/test.docx",
    "https://raw.githubusercontent.com/scanny/python-pptx/master/tests/test_files/test.pptx"
  ],
  "includeTables": true,
  "maxChars": 500000
}
```

### Licences

Runtime dependencies:

- apify — Apache-2.0
- python-docx — MIT
- python-pptx — MIT
- lxml — BSD
- odfpy — used under its Apache-2.0 option (its licence also offers GPL/LGPL options; we rely on the Apache option)

EPUB parsing is our own `src/epub.py` built on `zipfile` + `lxml`; ebooklib (AGPL-3.0) was
removed because AGPL is not acceptable for a public network actor. `httpx` (BSD) is used
only by the local deploy tool, not in the actor runtime.

# Actor input Schema

## `urls` (type: `array`):

Public http(s) links to .docx, .pptx, .odt, .odp or .epub files (max 50 per run). The file type is detected from the file content, not the URL extension. Legacy .doc/.ppt are reported as unsupported\_format and not charged.

## `includeTables` (type: `boolean`):

Also extract table contents from Word and PowerPoint documents, rendered as pipe-separated rows.

## `maxChars` (type: `integer`):

Longer text is cut at this limit and the result is marked truncated (still charged once, like a normal success). Hard cap 500000.

## Actor input object example

```json
{
  "urls": [
    "https://raw.githubusercontent.com/python-openxml/python-docx/master/tests/test_files/test.docx",
    "https://raw.githubusercontent.com/scanny/python-pptx/master/tests/test_files/test.pptx"
  ],
  "includeTables": true,
  "maxChars": 500000
}
```

# Actor output Schema

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

One dataset item per input URL: status (ok, download\_failed, unsupported\_format, invalid\_file or empty), file type (docx, pptx, odt, odp or epub), full text, structured sections, word/character counts, metadata and error reason. Only items with status ok are charged.

# 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 = {
    "urls": [
        "https://raw.githubusercontent.com/python-openxml/python-docx/master/tests/test_files/test.docx",
        "https://raw.githubusercontent.com/scanny/python-pptx/master/tests/test_files/test.pptx"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("glistening_film/office-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 = { "urls": [
        "https://raw.githubusercontent.com/python-openxml/python-docx/master/tests/test_files/test.docx",
        "https://raw.githubusercontent.com/scanny/python-pptx/master/tests/test_files/test.pptx",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("glistening_film/office-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 '{
  "urls": [
    "https://raw.githubusercontent.com/python-openxml/python-docx/master/tests/test_files/test.docx",
    "https://raw.githubusercontent.com/scanny/python-pptx/master/tests/test_files/test.pptx"
  ]
}' |
apify call glistening_film/office-document-text-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,glistening_film/office-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/qeMN8VRy0fZagDz4w/builds/8mkDMEtuvJ7yzc4b5/openapi.json
