microsoft / microsoft/markitdown

Feature Request: Support for password-protected documents (PDF, DOCX, XLSX)

Open
#1,585 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
186k
Forks
13.7k
Avg merge
1d 4h
Merged PRs (30d)
49

Description

Problem

Many business documents are password-protected for security, but MarkItDown currently fails to convert them, throwing errors instead of gracefully handling the situation.

Use Case

Users often need to process password-protected documents through automated pipelines. Currently, they must either:

  1. Manually remove passwords before processing
  2. Use external tools to strip passwords
  3. The tool simply fails with an unhelpful error

Proposed Solution

Add optional password parameters to the MarkItDown class and CLI:

Python API
from markitdown import MarkItDown

md = MarkItDown()
result = md.convert("protected.pdf", password="mypassword")
result = md.convert("protected.docx", password="mypassword")
result = md.convert("protected.xlsx", password="mypassword")
CLI
markitdown protected.pdf --password mypassword
markitdown protected.docx -p mypassword

Implementation Suggestions

  1. Add optional password parameter to the convert() method
  2. Add --password / -p CLI flag
  3. For PDF: Use pypdf or PyPDF2's encryption support
  4. For DOCX: Use python-docx's decrypter or mammoth's options
  5. For XLSX: Use openpyxl's workbook encryption handling
  6. Return a clear error message if password is incorrect or not provided

Behavior

  • If password-protected and no password provided: Show clear error message
  • If wrong password: Show "incorrect password" error
  • If password correct: Process normally

This would make MarkItDown much more useful in enterprise environments where document security is common.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the MarkItDown.convert() API and the CLI entry point described in the issue, then trace how PDF, DOCX, and XLSX conversion currently handles protected files. Done means optional passwords work through both interfaces, unprotected files still convert normally, and missing or incorrect passwords produce clear errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.