↓Skip to main content

Excel to BIR DAT File: Fixing Trailing Spaces, Line Breaks, and Invisible Characters That Fail Validation

A cell in Excel can look exactly right — same text, same alignment, same font — while still carrying a trailing space after the visible text, a line break hidden inside a single cell, or an invisible non-breaking space pasted in from a web page or PDF, and any one of these can make a BIR DAT file fail validation for reasons that aren’t visible just by looking at the spreadsheet. Because these characters don’t change what a cell looks like on screen, they are some of the hardest DAT file errors to catch by eye, and some of the easiest to miss until the BIR’s own validator rejects the file.

Convert Excel to a Clean DAT File FREE →

Why invisible characters survive an Excel-to-DAT conversion undetected #

A BIR DAT file is a plain-text, delimiter-separated format with no visual rendering of its own, so a character that was invisible in Excel stays exactly as invisible once it lands in the converted text file — nothing about the conversion process strips or flags whitespace and hidden characters unless the conversion tool is specifically built to do so. This site’s own guide to the format describes the underlying structure plainly:

“A BIR DAT file is plain text with fields separated by a fixed delimiter, one logical record per line, in the column order the Alphalist Data Entry and Validation Module expects for that filing type.”

— What Is a BIR DAT File?

Because each field occupies a specific position relative to the delimiter, an invisible character sitting inside a field doesn’t just look odd — it can change the effective length or exact content of that field, which the validator compares against its expected pattern for that column. A TIN field that is supposed to be a clean string of digits, for example, fails a format check if it secretly carries a trailing space after the last digit, even though copying that same cell’s visible content into a search box would show nothing wrong.

The three invisible-character problems, and how each one breaks differently #

ProblemHow it gets inHow it breaks the DAT file
Trailing or leading spaceTyped accidentally, or left over from copy-pasting a value out of another systemThe field no longer matches an exact-length or exact-value check (a TIN, ATC code, or amount field expecting a precise format now has extra characters padding it)
Embedded line break inside one cellPasted from a multi-line source (an email, a PDF table, a Word document) using Alt+Enter or a paste that preserves line breaksA single logical record gets split across two or more lines in the output DAT file, corrupting the one-record-per-line structure every downstream row depends on
Non-breaking space or other invisible Unicode characterPasted from a web page, PDF, or formatted document that used a non-breaking space (common in copied addresses or names) instead of an ordinary spaceLooks identical to a normal space on screen, but is a different underlying character — a validator or lookup comparing the field against a reference value can treat it as a mismatch even though the text reads the same

All three share the same root problem: Excel renders them invisibly, so a visual check of the spreadsheet — even a careful one — won’t catch them before conversion.

How to find and strip these characters before conversion #

Finding invisible characters means testing for them deliberately rather than relying on how a cell looks, since a visual scan of the spreadsheet will not catch any of the three problems above. Work through these checks before generating the final DAT file:

  1. Use TRIM() on every text field that will become a DAT file column. Excel’s TRIM() function removes leading and trailing spaces and collapses multiple internal spaces to one — run every name, address, and code field through it in a helper column rather than assuming the source data is already clean.
  2. Check cell length against the expected value. For fields with a known fixed or expected length (a TIN, for instance), use LEN() in a helper column and flag any row where the length doesn’t match what’s expected — a value that looks like a complete TIN but returns an unexpected length almost always has a hidden extra character.
  3. Search for line breaks inside cells. Use Find & Replace with “Use wildcards” or a formula testing for CHAR(10) to locate cells containing an embedded line break, especially in any column built from pasted multi-line source data.
  4. Flag non-breaking spaces specifically. A formula testing for CHAR(160) (the non-breaking space code point) catches this invisible character, which an ordinary visual check or even a simple TRIM() may not remove, since TRIM() only strips the standard ASCII space character by default.
  5. Regenerate the DAT file from the cleaned data, then validate. As with any other DAT file content fix, correct the source spreadsheet and reconvert — don’t hand-edit the already-generated DAT file in a text editor, which risks shifting field positions the same way a manual fix to any other structural error does.

Worked example: a TIN that “looks” right but fails validation #

A bookkeeper copies a supplier’s TIN, “123-456-789-000,” from an old filing PDF into a new payee list. The pasted value looks identical to every other TIN in the column — same digits, same formatting, same font — but it carries one trailing space at the end, invisibly inherited from how the PDF’s text layer broke that cell.

When the spreadsheet converts to a DAT file, that field no longer matches the exact digit-length pattern the validator expects for a TIN column, and the row is rejected — while every other visually identical-looking TIN in the same file passes cleanly. Running LEN() across the TIN column would have flagged this one row as one character longer than the rest, well before the file ever reached eSubmission.

Summary #

Trailing spaces, embedded line breaks, and non-breaking spaces are invisible in Excel but not invisible to a BIR DAT file validator that checks exact field content and length, so a clean-looking spreadsheet can still fail validation for a reason a visual check won’t find. Running TRIM(), LEN(), and a targeted check for line breaks and non-breaking spaces on every text field before conversion catches all three before they reach eSubmission. For the format basics this builds on, see What Is a BIR DAT File?, and for a related data-content problem, see BIR DAT File Special Characters and Encoding Errors.