Skip to main content
Save 30% on your first year
Receipts & capture

Line-item extraction

Reading each line of a receipt or invoice into structured data: description, quantity, unit price, amount and tax.

In short

  • Header extraction gets the merchant, date and total. Line extraction gets what was actually bought.
  • It is harder than reading totals because layouts, abbreviations and wrapped lines vary endlessly.
  • A good extraction adds up. If the lines don't sum to the total, something was missed.

Line-item extraction is the step that turns the body of a receipt or invoice into rows of data. Each row holds a description, a quantity, a unit price, an amount and, where the document shows it, a tax code. It usually runs after optical character recognition has turned the image into text.

Why it is harder than it looks

Totals sit in predictable places and come with labels. Lines do not. Descriptions are abbreviated ("CHKN CSR WRP"), long descriptions wrap onto a second line, quantities appear before or after the name, and discounts show up as separate negative lines that belong to the item above them. A line extractor has to decide which fragments form one item, which is where most errors happen.

Checking the result

The most useful test is arithmetic. The extracted lines, plus tax, minus discounts, should equal the printed total. When they don't, the document should be flagged for review rather than posted.

Line data is what makes itemized policies, split coding and tax-by-line possible. Without it, a system only knows that money was spent, not on what.

Worked example

A hardware store receipt

DescriptionQtyAmount
Deck screws 2.5 in2$25.98
Exterior stain 3.7 L1$54.99
Brush set1$12.49

Subtotal $93.46, HST $12.15, total $105.61. The extracted lines add up to the printed total. The receipt can be coded without anyone opening it.

Get started

Spend less time on the paperwork behind these words.

Smartbills collects receipts at the point of sale and from your inbox, codes them and sends them to your accounting software with the evidence attached.