Skip to main content

Document Processing

Beyond Excel data, X21 can ingest external documents—such as specifications, PDFs, or screenshots—and reason about them alongside the workbook. Claude’s multimodal capabilities allow it to extract insights, compare documents to sheet data, and generate summaries.

Supported Inputs

  • PDF documents up to roughly 100 pages (based on size heuristics). Useful for requirements, financial statements, or policy documents.
  • Images (PNG/JPEG) for charts, dashboards, or handwritten notes.
  • Files are attached via the task pane and transmitted as base64 in the documentsBase64 array.

Processing Flow

  1. The UI encodes attachments and adds metadata (name, type, size) to the WebSocket payload.
  2. parseDocumentFromRequest converts them into Anthropic message blocks (type: "document" or "image").
  3. The orchestrator stores attachment traces in Langfuse, including counts and estimated PDF pages.
  4. Claude reads the documents in context with the workbook, enabling tasks like:
    • Summarising lengthy PDFs.
    • Checking if spreadsheet data matches values in attached invoices.
    • Extracting bullets from a presentation slide and inserting them into Excel.

Working with Outputs

  • Claude references document content explicitly in its responses, often quoting sections or page numbers (when discernible).
  • You can ask it to populate tables based on document insights using write_values, or to highlight mismatches with comments.
  • For large PDFs, encourage Claude to summarise in stages (e.g., per section) to keep responses manageable.

Privacy & Storage

  • Attachments stay in memory and are not persisted to disk by X21. They are discarded after the request finishes.
  • Telemetry (Langfuse, PostHog) records metadata but not the raw document contents unless you extend the instrumentation.
  • Ensure documents comply with your organisation’s data handling policies before attaching them.

Troubleshooting

  • Oversized files trigger validation errors in the UI. Compress or split the document before retrying.
  • Non-supported MIME types are skipped. Claude will note that a file couldn’t be processed.
  • If Claude ignores an attachment, remind it within the prompt (e.g., “Use the attached PDF named Contract.pdf to answer.”).
Document processing lets you treat X21 as a contextual assistant that understands both Excel data and supporting materials, making it ideal for audits, reporting, and research workflows.