> AI agents: this is one page from Mammoth Analytics documentation. The index of all pages as Markdown is https://mammoth.io/docs/llms.txt. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get Markdown.

# Write instructions for PDF table extraction in Mammoth

> Write a Custom instruction for Mammoth's PDF extraction: name the fields, types and pages you want, with good and vague examples for invoices and reports.
>
> Applies to: PDF extraction can depend on your plan. Where: Data Library › your PDF › Extract Data › What to import › Custom

The **Custom** option in PDF extraction imports exactly what you describe. In **Review data import**, under **What to import**, choose **Custom** and write your instruction in the text box. For the rest of the flow, see [Extract tables from PDFs and images](https://mammoth.io/docs/learn/get-data-in/extract-from-pdfs/).

## Use the Custom text box

The box shows the placeholder *"Describe what to import from this PDF…"*. Under **TRY:**, click a suggestion to fill it: **Convert all content into tables** or **Extract existing tables only**. **Extract** stays disabled until you write an instruction, and Mammoth shows "Describe what to import first".

## Good and vague instructions

|  | Example | Why |
| --- | --- | --- |
| **Good** | *"Extract the invoice number, vendor name, invoice date (MM/DD/YYYY), and total amount (numeric) from this invoice"* | Field names, data types and a clear scope |
| **Good** | *"Get all line items: product name, quantity, unit price, and line total"* | Matches the table structure in the document |
| **Good** | *"Extract only the summary table on page 1"* | Narrows the scope to avoid noise |
| **Vague** | *"Get the data"* | No field names, so the AI guesses what matters |
| **Vague** | *"Extract the table"* | Unclear when there are several tables |
| **Vague** | *"Get the numbers"* | No column names or context |

## Tips for a precise extraction

- State expected data types: `"total amount (numeric)"`, `"date (MM/DD/YYYY format)"`.
- Use the exact field names you want as column names.
- Mention the page number if the data is on one page.
- If the result isn't right, change what to import and extract again. You don't need to re-upload the file.

## Example instructions by document type

| Document | Instruction |
| --- | --- |
| Invoices | *"Extract invoice number, vendor name, invoice date, due date, and total amount from this supplier invoice"* |
| Reports | *"Extract the department name, report period, and all KPI values from this monthly performance report"* |
| Forms | *"Extract applicant name, years of experience, current employer, and desired salary"* |
| Bank statements | *"Extract statement date, beginning balance, ending balance, total deposits, and total withdrawals"* |
| Contracts | *"Extract party names, effective date, contract value, and termination clause from this agreement"* |
| Research tables | *"Extract all data from the results table on page 3, include the variable name, N, mean, and standard deviation columns"* |

Once an instruction works, Mammoth can replay it on the next file: see [Read new PDFs the same way](https://mammoth.io/docs/learn/get-data-in/read-pdfs-the-same-way/).

## Related

- [Extract tables from PDFs and images](https://mammoth.io/docs/learn/get-data-in/extract-from-pdfs/): the full extraction flow, limits and troubleshooting.
- [Read new PDFs the same way](https://mammoth.io/docs/learn/get-data-in/read-pdfs-the-same-way/): reuse your instruction on later files.
- [Upload files](https://mammoth.io/docs/learn/get-data-in/upload-files/): upload the PDF first.

---
Source: https://mammoth.io/docs/learn/get-data-in/pdf-extraction-instructions.md · Updated: 2026-11-08
