Skip to main content

What is a parsing rule and how do I create one?

A parsing rule tells Docparser which piece of data to pull from a document, such as an invoice date, a total or a table of line items. You usually create one rule for each field you need.

What is a parsing rule?

Each parsing rule extracts one piece of data from your documents. Typical examples are an invoice date, a total amount, or the line items in a table.

Parsing rules listed in a Docparser parser

How parsing rules work

Every rule follows the same three steps:

  1. Choose the kind of data you want.
  2. Show Docparser where to find it.
  3. Optionally, clean up the result with filters.

Create your first parsing rule

1. Add a rule

Click Create First Parsing Rule, or Add Parsing Rule if your parser already has rules.

The button to create a parsing rule

2. Choose a preset

Pick the preset that matches your data. For single values like an invoice number, use Text Fixed Position or Text Variable Position. For tables, use Table Data.

Choosing a parsing rule preset

Docparser also suggests presets for your document type, such as invoices, purchase orders and bank statements. You'll find generic presets for flexible extraction and advanced presets for more control.

Tip

Presets are shortcuts

Each preset comes with its own starting filters. Text Fixed Position (select an area), Text Variable Position (find a keyword) and Table Data (pick a table) cover most needs.

3. Show Docparser where the data is

There are three main ways to select data. Pick the one that fits your document.

Click and drag

Use this when the data is in the same place on every document. Highlight the area you want. It works best for documents with a consistent layout that aren't scans.

Selecting an area by clicking and dragging

Use a keyword

Use this when the value moves around but always has a label next to it, such as Invoice Number, Total or Date.

Finding a value using a nearby keyword

Use a table rule

Use this for repeating rows, such as line items, transactions or lists. It's the best choice when you need many rows from the same area.

Selecting a table of line items

Which one should you use?

Your data Method Preset
Always in the same position Click and drag Text Fixed Position
Has a label next to it Keyword Text Variable Position
Several repeating rows Table rule Table Data or Line Items
Something else Browse the full list of presets. Some advanced presets find data without a fixed position.

Tip

Single values or tables?

Rules come in two kinds. Single-value rules pull one item, such as a date, total or reference number. Table rules pull repeating data, such as line items or rows.

4. Refine your results (optional)

If the extracted data needs adjusting, add filters to:

  • remove unwanted text
  • format dates or numbers
  • keep only part of a value

Filters are covered in more depth in What filters are available in Docparser?

See it in action

This screencast walks through creating a first parsing rule, step by step.

Need help?

Our support team is happy to help you set up your rules. Submit a request and include a sample document.

Next up · Step 5 of 5 Export your data Download your results, or send them automatically to tools like Google Sheets.
Was this article helpful?
24 out of 38 found this helpful

Still stuck?

Send us your parser name and a sample document.

Submit a request