# Docs to Markdown for AI (Word, Excel, PowerPoint, PDF) (`k09/docs-to-markdown`) Actor

Convert DOCX, XLSX, PPTX, PDF, HTML and CSV to clean Markdown for LLMs, RAG and knowledge bases. Keeps headings, lists and tables; optional chunking with heading paths. Pay per document.

- **URL**: https://apify.com/k09/docs-to-markdown.md
- **Developed by:** [K09 Tools](https://apify.com/k09) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.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

## Docs to Markdown for AI: DOCX, XLSX, PPTX & PDF to Markdown

A **document to Markdown converter** built for LLMs: **Word to Markdown** (DOCX), **Excel to Markdown** (XLSX), **PowerPoint to Markdown** (PPTX), **PDF to Markdown**, HTML and CSV. Use it to prepare documents for RAG pipelines, vector databases, LangChain or LlamaIndex, ChatGPT or Claude knowledge bases, and chatbots, or simply to get clean text out of Office files. No setup or libraries to install: pay per document, with built-in chunking.

> Converting a single Word file by hand? Use the free browser version: **[K09 Word to Markdown](https://k09zz.github.io/k09-tools/word-to-markdown/)**. This Actor handles all formats in bulk, with chunking and API access.

### Supported formats

| Format | What you get |
|---|---|
| **Word (.docx)** | Headings, paragraphs, **bold**/*italic*, lists, links and tables. Images are replaced by their alt text. |
| **Excel (.xlsx)** | One `##` section per visible sheet, each as a Markdown table. Formula results, dates as ISO (`2026-09-01`), empty columns removed. |
| **PowerPoint (.pptx)** | One `## Slide N: Title` section per slide in presentation order, with nested bullets, tables and **speaker notes**. |
| **PDF** | Text in reading order, tables as Markdown tables, `<!-- page N -->` markers. |
| **HTML** | Main content as Markdown. Scripts, styles, navigation and footers are removed. |
| **CSV / TSV** | A Markdown table (delimiter detected automatically). |
| **Markdown / TXT** | Passed through, cleaned up. |

The format is detected from the file itself, so misnamed files still work.

### RAG-ready chunking

Set **Chunk size** (for example `2000`) to also get each document split into chunks of at most that many characters. Chunks are cut at headings first, then paragraphs, and each one carries its **heading path** (`Guide > Setup > Step 2`) so your embeddings keep their context. Chunks appear in the dataset's **Chunks (RAG)** view.

### How to use

1. Upload a file, or paste one or more links to documents you have the right to use.
2. Optional: set a chunk size.
3. Run it. Leave the input empty to try it free on a built-in sample.

### Output

One dataset row per document:

```json
{
  "fileName": "review.pptx",
  "format": "pptx",
  "title": "Quarterly Review",
  "markdown": "## Slide 1: Quarterly Review\n\nQ3 2026\n\n## Slide 2: Highlights\n\n- Revenue up 12%\n  - Driven by new customers ...",
  "wordCount": 41,
  "pageCount": 3,
  "pagesConverted": 3,
  "markdownUrl": "https://api.apify.com/v2/key-value-stores/.../records/doc1.md",
  "chunks": [{ "index": 0, "headings": "Slide 1: Quarterly Review", "text": "..." }]
}
```

Each document is also saved as a `.md` file you can download.

### Pricing

- **Document converted**: one charge per file, which includes up to 20 pages (PDF) or slides (PPTX).
- **Extra page**: each PDF page or slide beyond the first 20.

Failed files (broken links, unsupported types) are free. If you set a maximum cost for the run, the Actor converts as many pages as it covers and marks the document `truncated`.

### Limitations

- Old binary formats (`.doc`, `.xls`, `.ppt`) aren't supported. Save them as `.docx`/`.xlsx`/`.pptx` first.
- No OCR. Scanned PDFs and text inside images aren't extracted.
- Charts, SmartArt and embedded images are skipped. Their alt text is kept where available.
- Maximum file size: 50 MB.

### Privacy

Files are processed only inside your own run, and the output stays in your run's storage.

### Use it from code or AI agents

Every run can be started from the API, and results come back as JSON, CSV or Excel. Replace `YOUR_APIFY_TOKEN` with the token from **Apify Console → Settings → API & Integrations**.

**cURL** (runs the Actor and returns the results in one call):

```bash
curl -X POST "https://api.apify.com/v2/acts/k09~docs-to-markdown/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"fileUrls":["https://example.com/handbook.docx"],"chunkMaxChars":2000}'
```

**Python** (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("k09/docs-to-markdown").call(run_input={
    "fileUrls": [
        "https://example.com/handbook.docx"
    ],
    "chunkMaxChars": 2000
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

**JavaScript / Node.js** (`npm install apify-client`):

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

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('k09/docs-to-markdown').call({
  "fileUrls": [
    "https://example.com/handbook.docx"
  ],
  "chunkMaxChars": 2000
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**No-code and AI agents:** the Actor works with Apify's Zapier, Make and n8n integrations, can run on a schedule from the Console, and can be used as a tool by AI agents through Apify's MCP server (see Apify's MCP documentation).

# Actor input Schema

## `file` (type: `string`):

Upload a document or paste a link to one. Supported: DOCX, XLSX, PPTX, PDF, HTML, CSV, Markdown, TXT (up to 50 MB).

## `fileUrls` (type: `array`):

Links to documents you have the right to use, one per line. Leave everything empty to try the Actor on a built-in sample (free).

## `chunkMaxChars` (type: `integer`):

Also split each document into chunks of at most this many characters, cut at headings and paragraphs, each with its heading path. 0 = no chunking. Typical: 1000-4000.

## Actor input object example

```json
{
  "chunkMaxChars": 0
}
```

# Actor output Schema

## `documents` (type: `string`):

No description

## `chunks` (type: `string`):

No description

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

No description

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("k09/docs-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 = {}

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,k09/docs-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/A1SF53nI6Fvgj1WcP/builds/26Ei4JIFS83TTsRaF/openapi.json
