> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firecrawl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# ドキュメントパース

> ドキュメントのパース機能について学ぶ

Firecrawl は強力なドキュメント解析機能を備えており、さまざまなドキュメントフォーマットから構造化コンテンツを抽出できます。この機能は、スプレッドシートや Word 文書などのファイルを処理する際に特に有用です。

<div id="supported-document-formats">
  ## サポートされているドキュメントフォーマット
</div>

Firecrawl は現在、以下のドキュメントフォーマットをサポートしています：

* **Excel スプレッドシート** (`.xlsx`, `.xls`)
  * 各ワークシートを HTML テーブルに変換します
  * ワークシートはシート名の H2 見出しで区切られます
  * セルの書式とデータ型を保持します

* **Word ドキュメント** (`.docx`, `.doc`, `.odt`, `.rtf`)
  * ドキュメント構造を保ちながらテキストコンテンツを抽出します
  * 見出し、段落、リスト、表を保持します
  * 基本的な書式とスタイルを保持します

* **PDF ドキュメント** (`.pdf`)
  * レイアウト情報とともにテキストコンテンツを抽出します
  * セクションや段落を含むドキュメント構造を保持します
  * テキストベースおよびスキャン PDF の両方に対応します (OCR 対応)
  * 解析方法を制御するための `mode` オプションをサポートします：`fast` (テキストのみ) 、`auto` (必要に応じて OCR を行うテキスト、デフォルト) 、`ocr` (OCR のみを使用)
  * 料金は1ページあたり1クレジットです。詳細は [Pricing](https://firecrawl.dev/pricing) を参照してください。

<div id="pdf-parsing-modes">
  ### PDF 解析モード
</div>

PDF の処理方法を制御するには、`parsers` オプションを使用します:

| Mode   | Description                                                             |
| ------ | ----------------------------------------------------------------------- |
| `auto` | まず高速なテキストベースの抽出を試行し、必要に応じて OCR にフォールバックします。これがデフォルトです。                  |
| `fast` | テキストベースの解析のみ（埋め込みテキスト）。最速のオプションですが、スキャンされたページや画像が多いページからはテキストを抽出しません。   |
| `ocr`  | すべてのページで OCR による解析を強制します。スキャンされたドキュメントや、`auto` がページを誤って判定してしまう場合に使用します。 |

```js theme={null}
// モード指定のオブジェクト構文
parsers: [{ type: "pdf", mode: "ocr", maxPages: 20 }]

// デフォルト（autoモード）
parsers: [{ type: "pdf" }]
```

<div id="how-to-use-document-parsing">
  ## ドキュメントパースの使い方
</div>

Firecrawl のドキュメントパースは、次の 2 通りで利用できます。

1. **URL ベースの解析 (`/v2/scrape`)**: 対応するドキュメント形式を指す URL を指定します。
2. **ファイルアップロードによる解析 (`/v2/parse`)**: `multipart/form-data` を使って、ファイルのバイト列を直接アップロードします。

URL ベースの解析では、Firecrawl が拡張子またはコンテンツタイプからファイル形式を自動的に判別します。

<div id="upload-documents-with-v2parse">
  ### `/v2/parse` でドキュメントをアップロードする
</div>

元のドキュメントがローカルにある場合、または URL 経由で一般公開されていない場合は、`/v2/parse` を使用します。

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.firecrawl.dev/v2/parse" \
    -H "Authorization: Bearer fc-YOUR-API-KEY" \
    -F 'options={"formats":["markdown"]}' \
    -F "file=@./document.docx;type=application/vnd.openxmlformats-officedocument.wordprocessingml.document"
  ```

  ```js Node theme={null}
  import { Firecrawl } from "firecrawl";

  const app = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });

  const doc = await app.parse(
    {
      data: "<html><body><h1>Upload Parse</h1></body></html>",
      filename: "upload.html",
      contentType: "text/html",
    },
    { formats: ["markdown"] },
  );

  console.log(doc.markdown);
  ```

  ```python Python theme={null}
  from firecrawl import Firecrawl
  from firecrawl.v2.types import ScrapeOptions

  app = Firecrawl(api_key="fc-YOUR-API-KEY")
  doc = app.parse(
      b"<!DOCTYPE html><html><body><h1>Upload Parse</h1></body></html>",
      filename="upload.html",
      content_type="text/html",
      options=ScrapeOptions(formats=["markdown"]),
  )
  print(doc.markdown)
  ```
</CodeGroup>

<div id="example-scraping-an-excel-file">
  ### 例: Excel ファイルのスクレイピング
</div>

```js Node theme={null}
import { Firecrawl } from 'firecrawl';

const firecrawl = new Firecrawl({
  // 開始にAPIキーは不要です — より高いレート制限が必要な場合は追加してください:
  // apiKey: "fc-YOUR-API-KEY",
});

const doc = await firecrawl.scrape('https://example.com/data.xlsx');

console.log(doc.markdown);
```

<div id="example-scraping-a-word-document">
  ### 例：Word ドキュメントのスクレイピング
</div>

```js Node theme={null}
import { Firecrawl } from 'firecrawl';

const firecrawl = new Firecrawl({
  // 開始にAPIキーは不要です — レート制限を引き上げるには追加してください:
  // apiKey: "fc-YOUR-API-KEY",
});

const doc = await firecrawl.scrape('https://example.com/data.docx');

console.log(doc.markdown);
```

<div id="output-format">
  ## 出力フォーマット
</div>

サポートされているすべてのドキュメントタイプは、クリーンで構造化されたmarkdownに変換されます。たとえば、複数のシートを含むExcelファイルは、次のように変換されることがあります。

```markdown theme={null}
## Sheet1

| Name  | Value |
|-------|-------|
| Item 1 | 100   |
| Item 2 | 200   |

## Sheet2

| Date       | Description  |
|------------|--------------|
| 2023-01-01 | First quarter|
```

> Firecrawl API key が必要な AI エージェントですか？自動オンボーディングの手順については、[firecrawl.dev/agent-onboarding/SKILL.md](https://www.firecrawl.dev/agent-onboarding/SKILL.md) を参照してください。
