The Workbench · The Shelf

A CSV export has to survive being reopened in Excel

A browser-only tracker can build a flawless CSV — every lot number, every date, every column exactly where the header says it is — and still hand the visitor a corrupted file, because the corruption doesn't happen in the tool. It happens a moment later, the instant Excel opens it. Excel doesn't read a CSV as text with commas in it; it reads a CSV as a guess about what each cell probably means, and the guessing rewrites data the file never asked it to touch. A tool that generates its own export and considers the job done at the download has stopped one step short of where the failure actually happens.

The file format has no types; Excel supplies its own

A CSV is a text format. It has no concept of a date, a number, or a string — every value is a sequence of characters between two commas, and whatever meaning that value carries lives entirely in the mind of whoever reads it next. Excel's import behavior fills that gap by guessing, cell by cell, based on what the text looks like. A value that looks like a date becomes a date, reformatted into whatever the system's regional settings prefer. A value that looks like a number becomes a number, and Excel's own numeric precision silently truncates anything past fifteen significant digits. None of this is a bug; it's the General cell format doing exactly what it was built to do. It just was never built with a regulatory tracker's identifiers in mind.

Where the guessing corrupts data that was never a date or a number

A lot number like “3-14” opens in Excel as March 14. A catalog ID like “007-B” survives, but a plain numeric ID like “00734” loses its leading zeros and becomes 734 — a different string than the one the system of record uses to look it up. A long identifier, a device serial number or an accession number run past fifteen digits, gets rounded in ways that make the sixteenth digit onward simply wrong, silently, with no warning dialog. None of these are edge cases a tracker can afford to wave off as unlikely: lot numbers, lab accession numbers, and lab-assigned sample IDs are exactly the kind of field a quality or regulatory CSV export exists to carry, and they're exactly the fields most likely to look like a date or a number to software that's never seen the identifier scheme behind them.

A second failure that has nothing to do with data types

A separate problem sits underneath the type-guessing one: a cell value that opens with =, +, -, or @ can be read by a spreadsheet application as the start of a formula rather than as text, a class of defect documented as CSV injection. A complaint narrative that happens to start with a minus sign, or a supplier name typed with a leading @, can execute as a formula the moment the file opens — in the ordinary case just displaying wrong, in a crafted one reaching out to an external resource or running a command through a legacy spreadsheet feature. A tool that builds its own CSV from visitor-entered or externally sourced text and ships that text verbatim into a cell hasn't just risked a formatting glitch; it's shipped an injection vector inside a file its own privacy design was built to keep safe.

The fixes belong in the file, not in a set of instructions to the user

Every one of these failures can be closed at generation time, before the file ever reaches a download. An identifier field that must stay literal text gets wrapped so Excel's importer treats it as a string rather than a number it should interpret — a leading apostrophe inside the cell, or a formula-style ="00734" wrapper, both tell Excel directly rather than hoping the reader knows to choose Text on import. A cell value that starts with =, +, -, or @ gets a neutralizing prefix added before it's written, every time, regardless of where that text came from. And the file itself should open with a UTF-8 byte-order mark, because without one Excel's legacy CSV importer assumes a different encoding and turns an em dash or a curly quote into a run of mangled characters on first open. None of this is advanced; all of it is a few lines in the export routine, and all of it is cheaper to fix once, in the code, than to explain once per visitor in a help article nobody reads before double-clicking a file.

Why this is a browser-only tool's problem specifically

This blog has already argued that a browser tool's output still has to leave the tab deliberately, built for the handoff it's actually headed toward rather than left as a rendered page the visitor has to improvise a capture method for. A CSV generated client-side, with no server round trip to catch or reformat it afterward, is that handoff for anything downstream has to ingest programmatically — and because nothing sits between the browser's export routine and the visitor's spreadsheet application, the export routine is the only place these fixes can happen at all. A checklist or tracker whose CSV export quotes identifier-like fields as text, neutralizes leading formula characters, and ships a UTF-8 BOM by default is previewed in the launch catalog. If a tool in your own stack has handed a lot number back as a date, the shelf takes that correction directly.

The Regulatory Toolkit launches soon — a free shelf of source-mapped templates, checklists and browser-only tools for regulatory teams. Get one email when it opens, or contribute a template.

All Workbench notes