# Document to Markdown — Word, PowerPoint, Excel, EPUB (`hermeskd/document-to-markdown`) Actor

Office, OpenDocument, EPUB, RTF and HTML file URLs in, Markdown out: headings, lists, tables, slides and sheets kept. Sheets become Markdown tables, slides sections. Pay per document.

- **URL**: https://apify.com/hermeskd/document-to-markdown.md
- **Developed by:** [Logan Parker](https://apify.com/hermeskd) (community)
- **Categories:** Agents, AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.60 / 1,000 document converteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

Give it URLs of Word, PowerPoint, Excel, OpenDocument, EPUB, RTF or HTML files; it returns each as Markdown — headings, lists, tables and slide or sheet structure preserved. Use it when you hold a link to a .docx, .pptx, .xlsx, .odt, .odp, .ods, .epub, .rtf or .html file and need its content as text. Agents are routinely handed office files they cannot open: one call returns the content with its structure, sheets as Markdown tables and slides as sections, and pricing is per document, so a file costs a fraction of a cent.

### Call it from an agent

Through Apify's MCP server (`https://mcp.apify.com`), tool `call-actor`:

```json
{"actor": "hermeskd/document-to-markdown", "input": {"urls": ["https://raw.githubusercontent.com/python-openxml/python-docx/master/tests/test_files/test.docx"]}, "callOptions": {"maxTotalChargeUsd": 0.05, "timeout": 600}, "waitSecs": 30}
```

The call returns the run's status and its `defaultDatasetId`. Read the records with `get-dataset-items`:

```json
{"datasetId": "<defaultDatasetId from the call>", "limit": 50}
```

As a dedicated tool, add `https://mcp.apify.com?tools=hermeskd/document-to-markdown` to your MCP client. A single file finishes well inside the 30-second wait, so one `call-actor` plus one `get-dataset-items` is the whole exchange. `maxTotalChargeUsd` caps what the run can charge; when it is reached the remaining URLs come back as `charge_limit_reached` records and are not charged.

### Input

| Field | Type | Required | Default | Meaning |
|---|---|---|---|---|
| `urls` | array of strings | yes | — | File URLs (.docx, .pptx, .xlsx, .odt, .odp, .ods, .epub, .rtf, .html), http or https, 1–50 per run, up to 50 MB each. The format is read from the file, not its name. |
| `sheetRowLimit` | integer | no | 1000 | Rows read from each spreadsheet sheet, the header row included (1–50,000). |
| `includeNotes` | boolean | no | `true` | Include each slide's speaker notes under a Notes heading. |

Every limit above is enforced by the input schema and again in code.

### Output

One record per input URL.

| Field | Meaning |
|---|---|
| `url` | The input URL. |
| `ok` | `true` when the document converted; `false` with `error`. |
| `format` | The format read from the file's bytes: `docx`, `pptx`, `xlsx`, `odt`, `odp`, `ods`, `epub`, `rtf` or `html`. |
| `markdown` | The document as Markdown. Word and OpenDocument text: headings, nested and numbered lists, tables, bold and italic, links. PowerPoint and OpenDocument presentations: `## Slide N: title`, text as bullets by level, tables, notes. Excel and OpenDocument spreadsheets: `## Sheet: name` and a table, the first row as its header. EPUB: the chapters in reading order. RTF: the paragraphs (styling is not read). HTML: the whole page body. Images and document properties are left out. |
| `sections` | For slides and sheets: `{index, title}` per slide or sheet, in order; empty for other formats. |
| `truncated` | `true` when a sheet had more rows than `sheetRowLimit`, or the Markdown was cut at 6 MB to fit one dataset record. |
| `error` | `{code, message}` when `ok` is `false`. |

Example record for the call above, as this Actor returned it in its deploy check on 2026-10-16:

```json
{
  "url": "https://raw.githubusercontent.com/python-openxml/python-docx/master/tests/test_files/test.docx",
  "ok": true,
  "format": "docx",
  "markdown": "# python-docx was here!\n\npython-docx was here too!",
  "sections": [],
  "truncated": false
}
```

### Events and prices

Pay per event; platform usage is included in the price, never passed through.

| Event | Title | Charged when | FREE / BRONZE | SILVER | GOLD / PLATINUM / DIAMOND |
|---|---|---|---|---|---|
| `document-converted` | Document converted | One file converted to Markdown. | $0.002 | $0.0018 | $0.0016 |

Apify also charges its standard `apify-actor-start` event: $0.00005 per GB of run memory (2 events, $0.0001, at the default 2,048 MB). The minimum maximum-charge a caller can set is $0.01.

Worked example on the FREE tier: 10 files cost 10 × $0.002 = $0.02, plus $0.0001 for the start, $0.0201 in all. A file is one document whatever its length; nothing is charged for a failed file.

### Limits and run time

- 1–50 URLs per run; files up to 50 MB; a zip-based file (Office, OpenDocument, EPUB) may unpack to at most 500 MB in at most 20,000 parts; up to 50,000 rows per sheet (1,000 by default).
- Each request — its redirects and its whole body included — must finish within 30 seconds (the per-request timeout; a slower file is `download_failed`); at most 2 requests a second go to one host.
- One record holds at most 6 MB of Markdown; a longer document is cut there and marked `truncated`.
- One document may take at most 120 seconds to convert; a file that needs longer is stopped and answered `too_large`, and the next document in the run starts fresh.
- Typical run time: a file converts in well under a second; a run of one file takes a few seconds at the default memory (2,048 MB). The default run timeout is 600 seconds.

### Errors

Errors are records with `ok: false` and `error.code`; none is charged.

| `error.code` | Meaning |
|---|---|
| `download_failed` | The URL did not return the file (status or network error). |
| `unsupported_format` | Not one of the listed formats (the message names the Hermes Actor for a PDF or an image; legacy .doc, .xls and .ppt are not read), a damaged file or one its reader cannot handle, or an archive over the unpacking limits. |
| `encrypted` | Password-protected, or an EPUB with DRM. |
| `too_large` | Larger than 50 MB, or too large or complex to convert within 120 seconds or within the converter's memory. |
| `robots_disallowed` | robots.txt forbids fetching the URL. |
| `blocked_host` | The host is on the deny-list, or resolves to a private or local address. |
| `timeout` | The document did not finish within the run's time budget. |
| `internal_error` | Unexpected failure; message carries the class. |
| `charge_limit_reached` | The run reached its maximum total charge before this URL; it was not processed. |
| `invalid_input` | The run input passed the input schema but cannot be used (for example no URL at all); the message names the field. One record per input given, or one with `url: null` when none was given; nothing is processed. |

The run fails only when every input failed with an Actor-side code (`internal_error`, `timeout`), so a broken Actor is visible. Every other run succeeds — including one where nothing converted because of the caller's own inputs (bad URL, robots, deny-list, an unsupported or encrypted file, invalid input, the charge limit), or where those and Actor-side failures are mixed.

### Sources and terms

The source is the caller's file. Process only documents you have the right to process. Fetching follows the Hermes fetch policy: robots.txt is obeyed for the user-agent `HermesBot` (and `*`), and a disallowed URL is refused without a request; platforms whose terms forbid automated access, and people-search sites, are on a deny-list and refused without a request; private and local addresses are refused, after DNS and on every redirect; the user-agent is `HermesBot/1.0 (+https://apify.com/hermeskd)`; no login, cookies, credentials, CAPTCHA solving, evasion or proxies are used. Document properties — authors, last editor, comments (their text, author and date) and tracked-change authors — are never returned.

### Not affiliated

This Actor is not affiliated with Microsoft, the Document Foundation, OASIS or the IDPF. mammoth, python-pptx, openpyxl, odfpy, markdownify, Beautiful Soup, lxml, striprtf and defusedxml are used under their open-source licences.

### Related Hermes Actors

- `pdf-to-markdown` — PDF documents to Markdown, with OCR for scanned pages.
- `image-to-text` — OCR for images.
- `audio-to-transcript` — speech to text.
- `video-frames` — frames and metadata from a video.
- `image-upscale` — image upscaling.
- `url-to-markdown` — a web page to Markdown.
- `audio-video-convert` — audio and video format conversion.

### Changelog

- 1.0 (2026-10-16) — comments in OpenDocument files are no longer read; a workbook with one far cell converts at once; a slide shape of unknown type is read as text; a file a reader cannot handle is `unsupported_format`, and one that cannot finish in 120 seconds is `too_large`.
- 1.0 (2026-10-16) — first release: nine formats, sheets as tables, slides as sections with notes, refusal of encrypted, damaged and oversized archives.

# Actor input Schema

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

URLs of .docx, .pptx, .xlsx, .odt, .odp, .ods, .epub, .rtf or .html files, http or https, 1–50 per run, up to 50 MB each. Each URL becomes one record; the format is read from the file, not its name.

## `sheetRowLimit` (type: `integer`):

Rows read from each spreadsheet sheet, the header row included (1–50,000); a sheet with more sets truncated.

## `includeNotes` (type: `boolean`):

Include each slide's speaker notes under a Notes heading (PowerPoint and OpenDocument presentations).

## Actor input object example

```json
{
  "urls": [
    "https://raw.githubusercontent.com/python-openxml/python-docx/master/tests/test_files/test.docx"
  ],
  "sheetRowLimit": 1000,
  "includeNotes": true
}
```

# Actor output Schema

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

One record per input URL with ok, format, markdown, sections, truncated and error.

# 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"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("hermeskd/document-to-markdown").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"] }

# Run the Actor and wait for it to finish
run = client.actor("hermeskd/document-to-markdown").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"
  ]
}' |
apify call hermeskd/document-to-markdown --silent --output-dataset

```

## MCP server setup

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

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/jfOFzMd6NQrWd8QMs/builds/cScCpwMJPPioupadV/openapi.json
