# Office Docs to Markdown – DOCX, PPTX, XLSX, HTML, EPUB for RAG (`pinkish_armada/office-to-markdown`) Actor

Convert Word, PowerPoint, Excel (XLSX/XLS), CSV, HTML, EPUB and Jupyter files from URLs into clean Markdown for LLMs and RAG: headings, lists, real tables, slide titles and speaker notes, sheets as JSON, optional chunks.

- **URL**: https://apify.com/pinkish_armada/office-to-markdown.md
- **Developed by:** [Phuc Tiet](https://apify.com/pinkish_armada) (community)
- **Categories:** AI, Developer tools
- **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 converteds

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

## Office Docs to Markdown: DOCX, PPTX, XLSX, HTML, EPUB for RAG

Turn **Word, PowerPoint, Excel, CSV, HTML, EPUB and Jupyter** files into **clean Markdown that LLMs, RAG pipelines and AI agents can use**. You get headings, lists, bold/italic text, links, **tables as Markdown and JSON**, slide titles and speaker notes, sheet data, document metadata, and optional **RAG chunks**.

Paste document URLs and click Start. Download the results as JSON, CSV or Excel, or use them via API, MCP, Make, Zapier or n8n.

### Why this one

- **One flat price per document.** $2 per 1,000 documents, whatever the format.
- **Format detected from the file itself.** Links without extensions (`/download?id=...`), wrong content types and signed URLs all work.
- **Word:** headings (including Title/Subtitle styles), nested lists, tables with proper header rows, links, bold/italic and footnotes. Inline images are reduced to their alt text, so the Markdown isn't bloated with base64. Images without a description and alt text that is just a file path are dropped.
- **PowerPoint:**
  - one `## Slide title` section per slide;
  - bullet hierarchy preserved;
  - tables, and chart data as tables;
  - speaker notes;
  - `<!-- slide N -->` markers for citations.
- **Excel / CSV:**
  - every visible sheet becomes a Markdown table;
  - empty rows, columns and sheets are removed;
  - dates come out as ISO;
  - optional **JSON rows keyed by the header row** (`sheetsAsJson`).
- **Formula cells:** where an Excel formula has no saved value, the formula is shown instead of a blank, with a warning.
- **HTML:** only the main content by default (no nav, header, footer or scripts).
- **Robust.**
  - Retries with backoff and file-size limits.
  - Clear error codes: `HTTP_404`, `UNSUPPORTED_FORMAT`, `ENCRYPTED`, `CORRUPT_FILE`, `TOO_LARGE`, `TIMEOUT`...
  - One bad file never stops the run, and **failed files are not charged**.

### Supported formats

| Format | Extensions |
|---|---|
| Word | `.docx` `.docm` `.dotx` |
| PowerPoint | `.pptx` `.pptm` `.ppsx` |
| Excel | `.xlsx` `.xlsm` and legacy `.xls` |
| Delimited text | `.csv` `.tsv` |
| Web | `.html` `.htm` |
| E-book | `.epub` |
| Jupyter | `.ipynb` |
| Text | `.json` `.xml` `.txt` `.md` |

PDFs: use [PDF to Markdown](https://apify.com/pinkish_armada/pdf-to-markdown) (priced per page, with OCR).

### Input

| Field | Default | Description |
|---|---|---|
| `documentUrls` | – | Direct document links (required). Up to 5,000 per run. |
| `chunkSize` / `chunkOverlap` | 0 / 200 | RAG chunks in characters (0 = off). |
| `includePlainText` | false | Add a plain-text version. |
| `sheetsAsJson` | false | Excel/CSV rows as JSON objects in `sheets[].rows`. |
| `maxRowsPerSheet` | 5000 | Truncate huge sheets (0 = no limit). |
| `includeHiddenSheets` | false | Convert hidden Excel sheets too. |
| `includeSpeakerNotes` | true | PowerPoint notes under each slide. |
| `slideMarkers` | true | `<!-- slide N -->` comments. |
| `htmlMainContentOnly` | true | Strip navigation/boilerplate from HTML. |
| `includeImageAltText` | true | Keep meaningful image descriptions. |
| `maxFileSizeMb` | 50 | Larger files are skipped (not charged). |

```json
{
  "documentUrls": ["https://calibre-ebook.com/downloads/demos/demo.docx"],
  "chunkSize": 1500
}
```

### Output

One dataset row per document:

```json
{
  "url": "https://calibre-ebook.com/downloads/demos/demo.docx",
  "status": "ok",
  "format": "docx",
  "fileName": "demo.docx",
  "title": "DOCX Demo",
  "author": "Kovid Goyal",
  "wordCount": 1649,
  "tableCount": 5,
  "markdown": "# Demonstration of DOCX support in calibre\n\nThis document demonstrates ...\n\n| ITEM | NEEDED |\n| --- | --- |\n| Books | 1 |",
  "tables": [{ "name": "Table 1", "headers": ["ITEM", "NEEDED"], "rows": [{ "ITEM": "Books", "NEEDED": "1" }] }],
  "chunks": [{ "index": 0, "text": "...", "heading": "Demonstration of DOCX support in calibre", "chars": 1398 }],
  "warnings": []
}
```

**Spreadsheets** add `sheetCount` and `sheets` (name, row/column counts, headers, and `rows` with `sheetsAsJson`). **Presentations** add `slideCount`.

**Errors and large results:**

- Failed documents get `"status": "error"` with `errorCode` and `error`.
- Very large results (over ~8 MB) are saved in full to the key-value store and linked from `fullResultUrl`.
- A run summary is saved as `OUTPUT`.

### How much does it cost to convert DOCX, PPTX and XLSX to Markdown?

Pay per event, plus a tiny Actor start fee ($0.00005 per GB of memory):

- **Document converted:** $0.002 per document ($2.00 per 1,000 documents).

Platform usage is included in the price. Failed downloads, unsupported or damaged files and password-protected documents are **not charged**. If you set a maximum cost per run, the Actor stops when it is reached.

### Limitations (honest)

- **Text and structure only.** Images are not OCR'd or described; only existing alt text is kept. Use the PDF Actor's OCR for scans.
- **Word layout:** text boxes, headers/footers and tracked changes may be skipped. Complex merged-cell tables are flattened.
- **Excel:** values come from the last save in Excel. Formulas are not recalculated. Charts and pivot caches are ignored.
- **Not supported:**
  - legacy binary `.doc`/`.ppt`, OpenDocument (`.odt`/`.ods`/`.odp`) and password-protected files;
  - ZIP archives, so link to the individual files.
- **Process only documents you have the right to use.** Files are processed inside your run and are not stored anywhere else.

### FAQ

**Can I upload a file instead of a URL?** Upload it to an Apify key-value store, Dropbox (use a `?dl=1` link), S3, Google Cloud Storage or similar, and pass the direct link.

**How fast is it?** Typically 0.05–1 s per document. A 200-page Word report with 80 tables takes about 7 s.

**Does it use an LLM?** No. It's a deterministic converter built on open-source libraries (mammoth, python-pptx, openpyxl, markitdown). Output is reproducible and there are no per-token costs.

### Use it from AI agents (MCP), the API, Make, Zapier and n8n

- **AI agents and MCP clients** (Claude, ChatGPT, Cursor, VS Code): add `https://mcp.apify.com?tools=pinkish_armada/office-to-markdown` as an MCP server, and your agent can convert Word, PowerPoint, Excel, HTML and EPUB files to Markdown as a tool call.
- **API**: run it and get the results in one request:

```bash
curl -X POST "https://api.apify.com/v2/acts/pinkish_armada~office-to-markdown/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"documentUrls":["https://calibre-ebook.com/downloads/demos/demo.docx"]}'
```

- **No-code**: use the official Apify apps for **Make**, **Zapier** and **n8n** ("Run an Actor"), then send results to Google Sheets, Slack, Airtable or your database. You can also schedule runs in Apify Console and add a webhook or email integration.

### Related tools

- [Sitemap URL Extractor](https://apify.com/pinkish_armada/sitemap-url-extractor): list every URL of a site from its sitemaps, with optional 404 checks
- [Broken Link Checker](https://apify.com/pinkish_armada/broken-link-checker): crawl a website and report broken links, 404s and redirects
- [PDF to Markdown](https://apify.com/pinkish_armada/pdf-to-markdown): turn PDFs (including scans, via OCR) into Markdown, text and tables
- [Domain Lookup](https://apify.com/pinkish_armada/domain-intel): bulk RDAP WHOIS, DNS, SPF/DMARC and SSL-expiry checks for domains

# Actor input Schema

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

Direct links to .docx, .pptx, .xlsx, .xls, .csv, .tsv, .html, .epub, .ipynb, .json, .xml, .txt or .md files (public URLs, signed S3/GCS links, Dropbox <code>?dl=1</code> links, Apify key-value store record URLs, ...). The format is detected from the file content. Up to 5,000 per run.

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

If set (e.g. 2000), also return <code>chunks</code>: Markdown split on paragraph boundaries with the current heading, ready for embedding. 0 = off.

## `chunkOverlap` (type: `integer`):

Characters of the previous chunk repeated at the start of the next one.

## `includePlainText` (type: `boolean`):

Also return a plain-text version without Markdown syntax.

## `sheetsAsJson` (type: `boolean`):

For Excel/CSV files, also return every sheet as JSON objects keyed by the header row in <code>sheets\[].rows</code>.

## `maxRowsPerSheet` (type: `integer`):

Rows beyond this are cut (with a warning) to keep the output usable. 0 = no limit.

## `includeHiddenSheets` (type: `boolean`):

Also convert sheets that are hidden in Excel.

## `includeSpeakerNotes` (type: `boolean`):

Add PowerPoint speaker notes under each slide.

## `slideMarkers` (type: `boolean`):

Insert <code>\<!-- slide N --></code> comments so you can cite slide numbers.

## `htmlMainContentOnly` (type: `boolean`):

For HTML files, keep only \<main>/\<article> (or drop nav, header, footer, aside and forms).

## `includeImageAltText` (type: `boolean`):

Keep meaningful image descriptions as <code>![alt](image)</code>. Images without a description are always dropped.

## `maxFileSizeMb` (type: `integer`):

Larger files are skipped with an error (not charged).

## `maxConcurrency` (type: `integer`):

How many documents are downloaded and converted at the same time.

## `requestTimeoutSecs` (type: `integer`):

Timeout for downloading each file (retried with backoff).

## Actor input object example

```json
{
  "documentUrls": [
    "https://calibre-ebook.com/downloads/demos/demo.docx"
  ],
  "chunkSize": 0,
  "chunkOverlap": 200,
  "includePlainText": false,
  "sheetsAsJson": false,
  "maxRowsPerSheet": 5000,
  "includeHiddenSheets": false,
  "includeSpeakerNotes": true,
  "slideMarkers": true,
  "htmlMainContentOnly": true,
  "includeImageAltText": true,
  "maxFileSizeMb": 50,
  "maxConcurrency": 2,
  "requestTimeoutSecs": 60
}
```

# Actor output Schema

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

Converted documents: markdown, format, title/author/dates, slide and sheet counts, tables, sheets, chunks, warnings, or errorCode/error for failed files.

## `summary` (type: `string`):

Documents succeeded/failed, documents charged and counts by format.

## `files` (type: `string`):

Full JSON results for documents too large for a single dataset row (document-N.json), linked from fullResultUrl.

# 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://calibre-ebook.com/downloads/demos/demo.docx"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pinkish_armada/office-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 = { "documentUrls": ["https://calibre-ebook.com/downloads/demos/demo.docx"] }

# Run the Actor and wait for it to finish
run = client.actor("pinkish_armada/office-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 '{
  "documentUrls": [
    "https://calibre-ebook.com/downloads/demos/demo.docx"
  ]
}' |
apify call pinkish_armada/office-to-markdown --silent --output-dataset

```

## MCP server setup

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