docx

Create, read, and edit DOCX files using Python with XML processing.

Updated Jan 29, 2026
One-click install
npx skills add https://github.com/metaid-developers/metaapp-skills --skill docx-metaid-developers
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/metaid-developers/metaapp-skills/tree/main/docx
Command: npx skills add https://github.com/metaid-developers/metaapp-skills --skill docx-metaid-developers

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires defusedxml, lxml, and includes scripts (resource) components.

What problem does it solve?

Word documents are often created, updated, and analyzed manually, which is error-prone and time-consuming. This Skill provides a programmable workflow for generating, reading, editing, and validating DOCX content, reducing manual effort and increasing reproducibility.

Core Features & Use Cases

  • Create new Word documents programmatically, including formatting, tables, and images, using a code-driven approach.
  • Read and analyze existing DOCX files by unpacking, inspecting XML, and validating structure and content types.
  • Edit and patch documents by manipulating underlying WordprocessingML, including tracked changes handling and content updates.
  • Use cases include generating standardized reports, assembling templated documents, and batch-editing large sets of documents.

Quick Start

Create a sample Word document named Demo.docx with a title, a paragraph, and a simple table to verify Word document generation.

Frequently Asked Questions about docx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate Word document creation and editing in Python?▼

Automate Word document creation and editing by using a Python-based pipeline that leverages defusedxml and lxml for XML processing. This approach supports programmatic generation, reading, and editing of DOCX content including formatting, tables, and images.

What is the best way to batch edit Word documents programmatically?▼

Batch edit Word documents programmatically by unpacking the files, manipulating the underlying WordprocessingML XML, and packing them back. This pipeline integrates a validator suite to ensure structure and content types are correct across large document sets.

How does Python read and analyze existing DOCX files?▼

Python reads and analyzes existing DOCX files by unpacking the document, inspecting the internal XML structure, and validating content types. This allows developers to extract content and perform quality checks across business, legal, and education workflows.

Do I need lxml and defusedxml to manipulate WordprocessingML?▼

Yes, you need lxml and defusedxml to manipulate WordprocessingML securely. This Skill implements its document editing and validation pipeline using these specific Python libraries to process XML and handle tracked changes or content updates.

Can I generate templated Word documents with tracked changes handling?▼

Generate templated Word documents with tracked changes handling by patching the underlying WordprocessingML. The pipeline supports assembling templated documents and applying content updates while maintaining document integrity through a validator suite.

What are the limitations of editing DOCX files via XML manipulation?▼

Editing DOCX files via XML manipulation requires unpacking and packing workflows, which may introduce complexity for simple text edits. Users must handle WordprocessingML structure carefully and rely on the integrated validator suite to prevent formatting corruption.