# Office-document & table triage

Preflight a document with `inspect` (JSON) _before_ deciding to read it in full.
All commands accept `--format json`, `-o <file>`, and `--ci`.

## `occ doc inspect <file>`

Inspect DOCX, PDF, or ODT document metadata, structure, and content preview —
metadata, risk flags, content stats, heading tree, and a short preview.

```bash
occ doc inspect report.docx --format json
occ doc inspect report.pdf --sample-paragraphs 10
```

Flags: `--sample-paragraphs <n>` (default 5), `--no-structure` (skip heading tree).

## `occ doc entities <file>`

Extract entities (emails, URLs, dates, phone numbers, mentions) and keywords
from a document. Defaults to `--format json`.

## `occ doc references [directories...]`

Detect cross-references between documents across directories. Defaults to JSON.
Flags: `--exclude-dir`, `--no-gitignore`, `--ignore-pattern`.

## `occ sheet inspect <file>`

Inspect XLSX workbook metadata, sheet inventory, schema hints, and lightweight
samples — including hidden sheets, named ranges, formulas, links, comments, and
token estimates.

```bash
occ sheet inspect finance.xlsx --format json --sample-rows 3 --max-columns 12
occ sheet inspect finance.xlsx --sheet "Q3"        # name or 1-based index
```

Flags: `--sheet <selector>`, `--sample-rows <n>` (default 5), `--header-row
auto|none|<n>` (default auto), `--max-columns <n>` (default 50).

## `occ slide inspect <file>`

Inspect PPTX or ODP presentation metadata, per-slide inventory, risk flags, and
content preview.

Flags: `--sample-slides <n>` (default 3), `--slide <number>` (1-based).

## `occ table inspect <file>`

Extract structured table data from DOCX, XLSX, PPTX, ODT, or ODP documents —
auto-detected headers, sample-row limits, merged-cell support.

```bash
occ table inspect report.docx --format json
occ table inspect finance.xlsx --table 2 --sample-rows 50
```

Flags: `--table <n>` (1-based), `--sample-rows <n>` (default 20), `--header-row
auto|none|<n>`.

## Pattern

`inspect --format json` → read the schema / risk flags / token estimate → only
then read full content (or extract tables) if the document is actually relevant.
