Why layouts differ so much from one bank to the next
Banks print statements in many shapes. Bank statement table detection starts from that variety. These layout variants are the reason a single template fails.
For example, some show one table with separate debit and credit columns. In contrast, others show one amount column and split the page into sections for deposits and withdrawals.
A third group prints signed amounts. For instance, a minus sign or parentheses mark money that leaves the account. Some statements place two or three tables side by side, with the same headers repeated. Also, daily balance tables often list several dates on one row.
Therefore, bank statement table detection cannot rely on one fixed template. Therefore, it needs header mapping, sign detection and a way to join continued tables. It also needs a way to find tables, name their columns and decide the direction of each amount. The article on bank model files shows how known layouts give the reader a head start.
How tables are found on native, scanned and photo pages
The kind of page decides the method. Bank statement table detection therefore begins with page type. First, input validation labels each page as native, scanned or photo.
A native page carries its own text, so words and coordinates are available directly. Native pages are the easy case.
For native and clean scanned pages, a model detects the table headers and columns. Next, rows are extracted by position. Native pages are processed in parallel, and the results are merged afterwards.
If header detection fails, the code builds a synthetic header from the column list. It estimates widths from the column type, with narrow dates, wider amounts and a wide description. However, a reviewer rarely sees this fallback, and it keeps the run going. Such fallbacks matter because one failed page should not stop the file.
Why a photo page needs its own way to find rows
Photos break row grouping by position. Perspective distortion makes a row slope across the page, which hurts bank statement table detection most. Fixed coordinates then group the wrong words together. DaletParse therefore uses a different route for bank statement table detection on photo pages.
First, a model locates the table boxes on each page. Second, a model reads the transactions from the image together with the OCR text. Finally, a deterministic correction uses OCR coordinates to fix small errors. Overall, the route trades speed for accuracy on difficult pages.
How header mapping turns odd titles into the right fields
Raw column titles vary a lot. For example, one bank writes post date, another writes trans date, and a third writes only date. Header mapping converts the titles of each transaction table into standard fields such as date, description, debit, credit and balance.
The mapper tries regular expression rules first. If the rules cannot place a column, it falls back to a model call. Thus, rules are cheap and repeatable, and they handle the common cases.
Header mapping also spots repeated patterns in the headers. A table with the headers number, date and amount three times in a row has three groups of three columns. Specifically, the groups and the stride are recorded, so each group becomes its own set of rows.
The table name helps header mapping as well. A table whose name holds withdrawals or debits is marked as a debit table. Likewise, a name with deposits or credits marks a credit table. Only unambiguous words count, because a wrong guess hurts and a missing one does not.
How sign detection decides debit or credit for each amount
A column of positive numbers says nothing about direction. Sign detection in bank statement table detection therefore follows a fixed order and stops at the first reliable answer.
- An explicit marker in the value counts, such as a minus sign, parentheses, a plus sign, DR or CR.
- A direction column printed by the bank counts, but only when the balance column confirms it.
- The table name counts.
- The first few descriptions suggest a direction.
- A model call can decide, and otherwise the amount stays generic. Sign detection is therefore a ladder from certain to uncertain.
Notably, separate debit and credit columns need no sign detection at all. Moreover, total lines such as a section total are skipped. Balance forward lines are also treated as anchors and not as transactions. A section total counted twice would break the balance check, so bank statement table detection skips it.
How continued tables are put back into one clean table
Long tables break across pages. The next page often starts with data rows and no header. It may also carry the word continued in the table name.
Continued tables must be joined, or the account loses lines. Reliable handling of continued tables is a core part of the work.
The reconstitution step handles continued tables first. It sorts tables in reading order. It detects continued tables by matching columns and the continued marker. Then it merges them into one transaction table and keeps the page of every row.
Besides, orphan rows without a clear start are attached to the previous table. In addition, a table whose amounts are an exact subset of another table is removed by a duplicate filter. It keeps the version with a daily balance first. Next comes the one with an average daily balance, and last the one with the most lines.
For continued tables, the page of each row stays visible in the export. A reviewer can then open the right page and check a line in seconds. Good bank statement table detection keeps that link.
How the checks catch what table detection still gets wrong
Even good bank statement table detection will sometimes fail. The balance check is the main safeguard, and the article on the running balance check explains it. Other validators work at a finer level.
First, a daily balance validator tests the running balance between lines. Second, a page balance validator checks the balance within each page. Third, a section total validator compares each section with the summary table. An example is the total of card withdrawals.
When a section total disagrees, a line is probably missing or extra in that section. However, for accounts that still fail, the repair steps take over. The article on multi-account statements shows how split accounts are handled.
What to look at when you test layouts on your own files
Collect statements with different shapes before the first run. For example, include one with split columns, one with a signed amount column, one with sections and one photo page. Add a statement that spans several pages and one with side by side tables. This set should cover the main layout variants.
Then compare three points for each file in your bank statement table detection test. First, check the table count against what you see. Check that each column landed in the right field and that each amount has the right direction.
Finally, open the transaction export and read the page column next to a few lines. The bank statement extraction page describes the full route. The PDF Association (opens in new tab) explains how PDF files are built. The International Organization for Standardization (opens in new tab) publishes the PDF standard itself.