Skip to main content

langchain-markitdown

Build License PyPI version Contributors

Markitdown LangChain Integration

This project provides document loaders that seamlessly integrate the Markitdown library with LangChain. Markitdown excels at converting various document types (DOCX, PPTX, XLSX, and more) into Markdown format. These loaders empower you to effortlessly load, process, and analyze these documents within your LangChain pipelines.

MarkItDown is a lightweight Python utility designed for converting diverse file formats into Markdown, optimized for use with Large Language Models (LLMs) and related text analysis workflows. It shares similarities with textract but distinguishes itself by prioritizing the preservation of crucial document structure and content as Markdown. This includes headings, lists, tables, links, and more. While the output is generally readable, its primary purpose is to be consumed by text analysis tools, rather than serving as a high-fidelity document conversion solution for human readers.

Explore the MarkItDown project on GitHub: https://github.com/microsoft/markitdown

Currently, MarkItDown supports:

  • PDF
  • PowerPoint
  • Word
  • Excel
  • Images (EXIF metadata and OCR)
  • Audio (EXIF metadata and speech transcription)
  • HTML
  • Text-based formats (CSV, JSON, XML)
  • ZIP files (iterates over contents)
  • YouTube URLs
  • EPUBs
  • ...and many more!

While this project borrows liberally from the amazing LangChain and Markitdown projects, it is not affiliated with either in any way.

Installation

Install the package using pip:

pip install langchain-markitdown

Usage & Features

The loaders expose a consistent interface that mirrors LangChain's built-in ones but leverage the MarkItDown converters under the hood. Highlights:

  • Centralized metadata handling: every loader emits success, conversion_success, content_type, and MarkItDown's native metadata (page count, attachments, output type, etc.).
  • Flexible splitting modes:
    • split_by_page=True partitions per-page/worksheet/slide output when MarkItDown provides page data.
    • headers_to_split_on=[("#", "Header 1"), ...] applies MarkdownHeaderTextSplitter to create logical sections from the converted Markdown.
  • Loader-specific metadata enrichment, e.g. DOCX core properties, XLSX workbook metadata via openpyxl, PPTX slide/image counts, and more.

Usage

Specific Examples

DOCX

from langchain_markitdown import DocxLoader, PptxLoader, XlsxLoader

loader = DocxLoader("path/to/your/document.docx")
documents = loader.load()

# Split by pages or headers when needed
documents_by_page = DocxLoader(
    "path/to/your/document.docx",
    split_by_page=True,
).load()

documents_by_headers = loader.load(
    headers_to_split_on=[("#", "H1"), ("##", "H2")],
)

PPTX

from langchain_markitdown import PptxLoader

loader = PptxLoader("path/to/your/presentation.pptx")
documents = loader.load()

XLSX

from langchain_markitdown import XlsxLoader

loader = XlsxLoader("path/to/your/spreadsheet.xlsx")
documents = loader.load()

Metadata

The Document objects returned by the loaders include the following metadata:

  • source: The path to the source file.
  • file_name: The name of the source file.
  • file_size: The size of the source file in bytes.
  • success / conversion_success: Boolean flags that include failure details when conversion fails.
  • content_type: Semantic tags such as document_full, document_section, document_page, workbook, worksheet, or presentation_slide.
  • page_number / worksheet: When splitting by page/worksheet.
  • markitdown_metadata: Raw metadata surfaced by MarkItDown (attachments, page counts, conversion format, etc.).
  • Loader-specific enrichments:
    • DOCX: author/title/subject/keywords/category/revision timestamps.
    • XLSX: workbook properties (author, title, subject, description, keywords, category).
    • PPTX: slide counts plus counts for images, tables, charts, and text boxes.

When header-based splitting is enabled, LangChain's header metadata is injected automatically.

Development & Testing

Install dependencies (and the package itself in editable mode) before running tests:

python -m pip install -r requirements.txt
python -m pip install -e .
pytest

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes.

License

MIT License

Trademarks

Markitdown, and so this project by extension, may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Metadata

Release files for langchain-markitdown 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-markitdown 1.0.0
File Size Uploaded
langchain_markitdown-1.0.0.tar.gz 17.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-markitdown 1.0.0
File Interpreter ABI Platform
langchain_markitdown-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.6 kB

Release files / langchain_markitdown-1.0.0.tar.gz

Download URL langchain_markitdown-1.0.0.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e6d6f5bb1822f14e59d78ff690a7c6a93e8af0394da3bd330b6450a1f3d84714
BLAKE2b-256 checksum
How to use checksums
78226c2a1131a274ae1217290394148dd4551fd2a11cabe810d4b574f72c7490
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2025.

Transparency log

Release files / langchain_markitdown-1.0.0-py3-none-any.whl

Download URL langchain_markitdown-1.0.0-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e35ed721a5aa7eb68e0b227d8766c0132f0681ba4cf8f259db0335f60d7075f2
BLAKE2b-256 checksum
How to use checksums
0bc6b7f5e07face92c57c24845e64c3a6ebd0cfa61b713c3c3f88fa0e326fe48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.8

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page