> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-opensw-1772748614-696205f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Docx files integration

> Integrate with the Docx files document loader using LangChain JavaScript.

The `DocxLoader` allows you to extract text data from Microsoft Word documents. It supports both the modern `.docx` format and the legacy `.doc` format. Depending on the file type, additional dependencies are required.

***

## Setup

To use `DocxLoader`, you'll need the `@langchain/community` integration along with either `mammoth` or `word-extractor` package:

* **`mammoth`**: For processing `.docx` files.
* **`word-extractor`**: For handling `.doc` files.

### Installation

#### For `.docx` files

```bash npm theme={null}
npm install @langchain/community @langchain/core mammoth
```

#### For `.doc` files

```bash npm theme={null}
npm install @langchain/community @langchain/core word-extractor
```

## Usage

### Loading `.docx` files

For `.docx` files, there is no need to explicitly specify any parameters when initializing the loader:

```javascript theme={null}
import { DocxLoader } from "@langchain/community/document_loaders/fs/docx";

const loader = new DocxLoader(
  "src/document_loaders/tests/example_data/attention.docx"
);

const docs = await loader.load();
```

### Loading `.doc` files

For `.doc` files, you must explicitly specify the `type` as `doc` when initializing the loader:

```javascript theme={null}
import { DocxLoader } from "@langchain/community/document_loaders/fs/docx";

const loader = new DocxLoader(
  "src/document_loaders/tests/example_data/attention.doc",
  {
    type: "doc",
  }
);

const docs = await loader.load();
```

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/document_loaders/file_loaders/docx.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
