Documents

Extract contact details and redact a copy

Pull tables, email addresses, phone numbers and amounts out of a customer document, then share a copy with emails, phone and card numbers and IBANs removed.

A new customer's onboarding form arrives as a Word file. The account team needs the contact details and the credit terms in the CRM; the warehouse team needs the document too, but without personal data or payment details. Two steps do it: Extract from Document keeps what you need in variables, Redact Document makes the shareable copy.

The document (customer-onboarding.docx) reads:

text
Customer onboarding — Exotic Liquids
Orders: Nancy Davolio <nancy.davolio@northwind.example>, phone +64 21 555 0100.
Accounts: accounts@exotic.example, (171) 555-2222.
Credit limit NZ$25,000.00; discount 2.5% on orders over $1,500.
Card on file: 4111 1111 1111 1111
Bank account: GB82 WEST 1234 5698 7654 32
See https://northwind.example/terms (updated 1 March 2026).

followed by a table of delivery addresses.

1. Extract the details

Extract from Document
{
  "type": "doc_extract",
  "label": "Extract details",
  "config": {
    "source": "{{form.onboarding_form}}",
    "extract_tables": true,
    "finders": ["emails", "phones", "amounts", "percentages", "urls", "dates"],
    "patterns": [{ "name": "customer", "pattern": "Customer onboarding — (.+)" }],
    "output_var": "details"
  }
}

The canvas shows tables · 1 pattern · emails, phones, amounts, percentages, urls, dates. {{details}} is:

{{details}}
{
  "file": "customer-onboarding.docx",
  "tables": [{ "header": ["Site", "Address", "City"], "rows": [["Head office", "12 Orchestra Terrace", "London"]], "records": [{ "Site": "Head office", "Address": "12 Orchestra Terrace", "City": "London" }] }],
  "rows": [{ "Site": "Head office", "Address": "12 Orchestra Terrace", "City": "London" }],
  "values": { "customer": "Exotic Liquids" },
  "found": {
    "emails": ["nancy.davolio@northwind.example", "accounts@exotic.example"],
    "urls": ["https://northwind.example/terms"],
    "phones": ["+64 21 555 0100", "(171) 555-2222", "1234 5698 7654 32"],
    "dates": [{ "text": "1 March 2026", "date": "2026-03-01" }],
    "amounts": [{ "text": "NZ$25,000.00", "value": 25000, "currency": "NZD" }, { "text": "$1,500", "value": 1500, "currency": "USD" }],
    "percentages": [{ "text": "2.5%", "value": 2.5 }]
  }
}

Use them in later steps: {{details_customer}}, {{details.found.emails.0}}, {{=FIRST(PLUCK(details.found.amounts, "value"))}} for the credit limit, {{details_rows}} for the addresses. Note that a plain $ is read as US dollars; the finders return what they see, so check the values that matter.

The phone finder works by pattern, so other grouped digits can turn up in found.phones — here the digits of the IBAN (1234 5698 7654 32); an order reference such as 2026-0042 can too. Use {{details.found.phones.0}} only when you know the layout, or a pattern for the phone line (phone\s+(\+?[\d ()-]{7,})). Redaction is not affected: the IBAN check claims those digits first.

2. Redact a copy

Redact Document
{
  "type": "doc_redact",
  "label": "Redact for warehouse",
  "config": {
    "source": "{{form.onboarding_form}}",
    "presets": ["email", "phone", "credit_card", "iban"],
    "terms": "Nancy Davolio",
    "replacement": "label",
    "output": "same",
    "clear_author": true,
    "output_var": "redacted"
  }
}

The canvas shows email, phone, credit_card, iban → redacted. Because the source is a Word file and Redacted copy is Same format, the copy is a .docx with its formatting kept and the text replaced inside it; the Author and Last modified by properties are cleared. {{redacted_text}} is:

text
Customer onboarding — Exotic Liquids
Orders: [TERM] <[EMAIL]>, phone [PHONE].
Accounts: [EMAIL], [PHONE].
Credit limit NZ$25,000.00; discount 2.5% on orders over $1,500.
Card on file: [CREDIT_CARD]
Bank account: [IBAN]
See https://northwind.example/terms (updated 1 March 2026).

and the run shows:

json
{ "variable": "redacted", "file": "customer-onboarding-redacted.docx", "redactions": 7, "counts": { "term": 1, "email": 2, "phone": 2, "credit_card": 1, "iban": 1 } }

The card number passed the Luhn check and the IBAN the mod-97 check, so other long numbers are left alone. With Replace with: █████ (block) each character becomes █ and the length stays visible; with Custom (text) every match becomes your text, such as [REMOVED].

3. Share it

Attach {{redacted_file}} to a Send Email to the warehouse, or upload it with a storage connector. To double-check, add Inspect Document with Search with context for @ on {{redacted_file}} and branch when {{inspection_match_count}} is not 0.

PDFs and other formats

A PDF cannot be edited in place safely, so Redact Document rebuilds it from the redacted text: the new PDF has the text, headings, lists and tables, and none of the redacted text, but not the original layout, fonts or images. The run logs: "The redacted PDF is rebuilt from the text: the original layout and images are not kept, and no redacted text remains in it". Its standard fonts show Latin (Windows-1252) characters only; others become "?". HTML stays HTML; OpenDocument files become PDF; Redacted copy can force pdf, html or text for any input.

For a scanned PDF, add "ocr": "auto" to the Redact step's configuration so the scanned pages have text to redact.