# Document to Markdown for AI — Word, PowerPoint, Excel, PDF (`tidydata/document-to-markdown`) Actor

Convert Word, PowerPoint, Excel, EPUB, HTML, CSV, JSON and text-based PDF files to clean Markdown for LLMs and RAG. Optional chunking with overlap. Tables kept. $3 per 1,000 documents; failed files are free.

- **URL**: https://apify.com/tidydata/document-to-markdown.md
- **Developed by:** [tidydata](https://apify.com/tidydata) (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.40 / 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

## 📄 Document to Markdown for AI — Word, PowerPoint, Excel, EPUB, PDF

Turn **Word, PowerPoint, Excel, EPUB, HTML, CSV, JSON, XML, text and text-based PDF files** into clean **Markdown** that LLMs read well. Headings, lists and **tables are kept**. Optional **chunking with overlap** for RAG and embeddings. **$3 per 1,000 documents**; files that fail are free.

- ✅ **.docx, .pptx, .xlsx/.xls, .epub, .html, .csv, .json, .xml, .txt and PDFs with text**
- ✅ **Tables → Markdown tables**, slides separated, spreadsheet sheets as sections
- ✅ **Chunks for RAG**: set a size (e.g. 1,000 characters) and overlap; cuts happen at paragraph boundaries
- ✅ One row per document: title, format, character count, Markdown, chunks
- ✅ Direct file links (max 50 MB each); processed and deleted, nothing kept but your results
- ✅ Works great from AI agents and automations (n8n, Make, MCP) because the output is plain text

### How to use it

1. Paste **links to your files** (a public link, a file in cloud storage with a shareable link, a file in an Apify storage…).
2. Optional: set **chunk size** and **overlap**, or turn off the full Markdown to get only chunks.
3. Run. Read the results in the dataset or through the API.

### Output example

```json
{
  "sourceUrl": "https://example.com/report.docx",
  "filename": "report.docx",
  "format": "docx",
  "title": "Quarterly Report",
  "status": "ok",
  "characters": 271,
  "markdown": "# Quarterly Report\n\nThis sample document …\n\n| Region | Sales |\n| --- | --- |\n| Europe | 120 |",
  "chunks": [{ "index": 0, "text": "# Quarterly Report …" }]
}
```

### Pricing

**$0.003 per document converted** ($3 per 1,000). Failed files and files without text are free.

### Limits

- **Scanned PDFs and images have no text** to extract. Use an OCR tool for those (for example our *PDF & Image to Text (OCR)* Actor).
- Password-protected files can't be read.
- Layout (columns, floating boxes) is simplified: this is about clean text for AI, not pixel-perfect conversion.

# Actor input Schema

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

Direct links to .docx, .pptx, .xlsx, .xls, .epub, .html, .csv, .json, .xml, .txt or text-based .pdf files (max 50 MB each). Use files you have the right to process. Scanned PDFs and images need an OCR tool instead.

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

Also split every document into chunks of about this many characters (cut at paragraph or heading boundaries), ready for embeddings and RAG. 0 = no chunks.

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

Characters repeated between consecutive chunks so context is not lost at the cut.

## `includeMarkdown` (type: `boolean`):

Turn off if you only want the chunks (smaller output).

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://api.apify.com/v2/key-value-stores/oaYnZ81lFD3Jt0fjF/records/sample.docx"
    }
  ],
  "chunkSize": 0,
  "chunkOverlap": 200,
  "includeMarkdown": true
}
```

# Actor output Schema

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

One row per document with its Markdown and optional chunks.

# 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": [
        {
            "url": "https://api.apify.com/v2/key-value-stores/oaYnZ81lFD3Jt0fjF/records/sample.docx"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidydata/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": [{ "url": "https://api.apify.com/v2/key-value-stores/oaYnZ81lFD3Jt0fjF/records/sample.docx" }] }

# Run the Actor and wait for it to finish
run = client.actor("tidydata/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": [
    {
      "url": "https://api.apify.com/v2/key-value-stores/oaYnZ81lFD3Jt0fjF/records/sample.docx"
    }
  ]
}' |
apify call tidydata/document-to-markdown --silent --output-dataset

```

## MCP server setup

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