Bulk render data hygiene: CSV that survives every row
Most failed bulk renders start in the spreadsheet, not the template. Encodings, delimiters, types and empty cells: a pre-flight contract for every batch.
The template is approved and the batch is queued, then row 212 fails on a number, a name or a column that no longer matches. Bulk render failures usually begin in the spreadsheet. Here is the data contract that keeps every row renderable.
The render that fails on row 212
The template is approved, the batch is queued, and 211 rows come back clean. Row 212 fails with a message about a number, or a name, or a field the system says does not exist. The file was exported from the same spreadsheet as last month, so nothing is wrong — except that a cell now contains a non-breaking space instead of a space, and the price is no longer a number.
Bulk render failures are usually not design failures. They are data failures that arrive disguised as template failures: an encoding the parser did not expect, a semicolon where a comma was promised, a column header that came back with an invisible byte in front of it. In a manual edit, a human fixes these by retyping a field. In a batch of 500 rows, nobody looks until the exports are already wrong.
This article covers the data contract between a spreadsheet and a renderer: what to normalise before a file reaches the API, and what to validate on arrival. Designing the inputs themselves is a separate exercise, covered in template input design.

What a spreadsheet does to data on the way out
Spreadsheets are built to be helpful, and most of that helpfulness is invisible in the saved file. A cell that displays 1.234,50 € may be stored as a number, as text, or as a formula, depending on where it came from. A date looks like a date until the export guesses a different format.
| What you see in the grid | What often leaves the file | What the renderer reports |
|---|---|---|
79,90 € | text with a decimal comma, symbol and space | “expected number, received string” |
2026‑11‑25 with a narrow no-break space | an unrecognised character inside a date | “invalid input” or an empty field |
Müller | two bytes that are not valid UTF-8 | “?” or a replacement character |
| A cell with a line break | an unquoted record break | a row with too few columns |
=1+2 pasted from a form | leading =, kept as is | rejected, or quoted and shipped |
| A “blank” cell | "", " ", "null" or a real empty value | a placeholder rendered instead of a fallback |
None of these is exotic: each is a predictable artefact of tabular exports, and each is caught by a normalisation step that runs before validation, not instead of it.
Encoding: the failure that looks like a typo
Text is bytes with a declared interpretation. When the declaration and the bytes disagree, names break first because they carry the non-ASCII characters.
A file exported in a legacy single-byte encoding stores ü as one byte value; a UTF-8 parser reads that byte as the start of a multi-byte sequence and either fails or substitutes U+FFFD. The Unicode FAQ on UTF-8, UTF-16 and BOM is explicit that ill-formed sequences must not be interpreted as characters, and UTF-8 is the preferred form for Unicode text files. Converting on ingest, rather than asking the parser to guess, keeps the failure visible in one place.
A byte-order mark is the second trap. With UTF-8 the BOM is only an encoding signature, not a byte-order marker. If the parser does not strip it, those three bytes become part of the first header name — and a header that no longer matches an input ID reads like a missing field, not like an encoding problem.
| Byte pattern | Visible symptom | Typical origin | Fix |
|---|---|---|---|
EF BB BF before the first header | “unknown column headline” | UTF-8 export that wrote a BOM | strip BOM, then trim header names |
C3 BC read as Latin-1 | Müller | UTF-8 file opened in a legacy tool | decode as UTF-8 end to end |
FC read as UTF-8 | M�ller or a parse error | Windows-1252 export | convert to UTF-8 before upload |
C2 A0 | price or date not recognised | copied from a web page | normalise to a plain space, then trim |
E2 80 8B | a value that “looks empty” but is not | copy from a chat or PDF | strip zero-width characters |
The cheapest habit is a rule with no exceptions: every file that enters the pipeline is UTF-8 without BOM. If a supplier cannot deliver that, convert at the edge and record it. Do not let two encodings meet inside the same batch.
Delimiters, quotes and the comma problem
CSV has a published shape. RFC 4180 defines records separated by CRLF, a header line with the same number of fields as the records, spaces counted as part of a field, and double quotes required around any field that contains a line break, a double quote or a comma. A double quote inside a quoted field is escaped by doubling it.
In many European locales the list separator is a semicolon, because the comma is the decimal separator; Excel lets you change that separator, and a file has to say which one it used. A local convention is still an illegitimate wire format for a parser expecting commas. Either export with commas and dot decimals, or convert to JSON and stop arguing about separators.
| Cell content | Correct CSV field | What breaks without it |
|---|---|---|
Shoes, running | "Shoes, running" | one field becomes two |
He said "go" | "He said ""go""" | quote closes early, rest of the row shifts |
| Two lines of copy | one quoted field with an embedded line break | an extra record with missing columns |
padded | preserved as-is; trim in the pipeline if unwanted | a silent mismatch in comparisons |
| Empty optional field | "" or omitted, decided once | "" renders as a blank instead of a fallback |
The last row is a design decision, not a formatting one: the template must know whether an empty value means “use the default headline” or “render nothing”. Write that down per field, because a row-level validator cannot infer intent.
Types: numbers, dates and the meaning of empty
A renderer does not see your cell formatting. It sees the value that survived the export, and then it parses that value against the input type published for the template.
JsonCut's template documentation states the contract plainly: CSV headers must match the template's input IDs, and values are parsed against the published input types before any valid row is queued. That is a good place for type errors to stop — but only if the data is already shaped like the type.
| Value in the grid | Reasonable canonical form | Why it matters |
|---|---|---|
79,90 € | 79.9 (number) or "79,90 €" (string) | currency symbols and decimal commas are not numbers |
1.234,50 | 1234.50 | thousands separators are ambiguous across locales |
25.11.2026 | 2026-11-25 | day-first versus month-first is unresolvable by guessing |
ja / nein | true / false | booleans have no localised spellings |
0 versus empty | 0 versus null | a zero discount is not a missing discount |
#NV or n/a | empty or a documented fallback token | spreadsheet errors are strings, not absences |
Two rules prevent most of these: send numbers as numbers with a dot decimal separator, and send dates in a single documented format across every batch. Everything else — currency display, thousands grouping, localised month names — belongs to the template's formatting, where it is applied consistently rather than parsed hopefully.
When the data is untrusted
A CSV is also an executable artefact for the person who opens it. OWASP documents CSV injection: cells beginning with =, +, - or @ may be treated as formulas by spreadsheet software, and quoting alone does not reliably neutralise them, because a spreadsheet may strip quotes on save and re-open. OWASP's conclusion is worth repeating in any pipeline design: there is no universal sanitisation that is safe for every spreadsheet application and every downstream consumer.
That has a practical consequence. If a field can be filled by an end user — a form name, a marketplace title, a support comment — treat it as untrusted and choose the format accordingly:
- JSON for machines. No formula semantics, no delimiter ambiguity; prefer it when the pipeline is fully automated.
- CSV for humans, sanitised at ingest. Strip or escape leading formula characters on arrival and document what changed.
- No untrusted markup. HTML-typed inputs expect sanitised HTML; the renderer should not be the first component to question a string.
Injection is a security problem with a data-quality twin: a title that starts with - is common, and a pipeline that mangles it produces wrong output that passes every check.
A pre-flight contract instead of a rescue
The goal is not a smarter parser. It is a batch that either fails loudly before queueing or renders correctly, with nothing in between. JsonCut already reports invalid rows with their index and a safe error, and invalid rows do not prevent valid ones from rendering. A short pre-flight pass on your side makes those reports short and boring.
| Check | Rule | Why it is cheap now and expensive later |
|---|---|---|
| Encoding | valid UTF-8, no BOM, no U+FFFD | replacement characters are invisible in a thumbnail |
| Row shape | column count equals header count on every row | a shifted row renders another product's data |
| Headers | names match published input IDs exactly | an unmatched header is a silent null, not always an error |
| Types | every value coercible to its published type | catches 79,90 € before it reaches row 400 |
| Empty policy | each field declares fallback or blank | prevents a placeholder in a live campaign |
| Key uniqueness | one idempotency key per intended output | a retry duplicates rows instead of resuming |
| Length budget | copy fits the text box at the longest locale | overflow is visible but easy to miss in a grid |
| Volume | rows fit the batch limit for your plan | 50 on Hobby, 250 on Pro, 500 on Business |
The idempotency key deserves its own decision. Derive it from a business key — sku-1042-de rather than a row number — so that a corrected resubmission updates the intended output instead of producing a second file with a slightly different name. JsonCut accepts a batch-level key for the request and optional row keys for individual outputs, and pins a batch to one immutable template version, which means a retry against the same version is comparable with the original attempt.
CSV size is bounded as well: a CSV body can be up to 2,000,000 characters, so a large catalogue is normally split into several batches rather than one giant file. Splitting by a stable key prefix keeps retries local and makes a failed batch a small incident.
The QC loop that keeps a batch honest
Even a clean file can produce a batch worth checking. The review gate described in the render review gate applies directly: check everything while the template is new, then sample deliberately.
- Open the first, a middle and the last row as rendered output. Off-by-one errors cluster at the edges.
- Search outputs for the replacement character and double spaces; both point at ingest, not design.
- Compare counts. A missing file with no error is the worst outcome, and only counting catches it.
- Spot-check the longest string. Overflow is a length-budget failure that no type validator sees.
- Keep the error report. A supplier's question should be answered with an index, not a memory.
Row-level failure handling — which errors are retryable, which are terminal, how partial batches are reported — is the subject of why one bad row should not stop your bulk render. Data hygiene is the step before that: it reduces the number of rows that need the machinery at all.
Rollout checklist
- Fix the wire format: UTF-8 without BOM, one delimiter, dot decimals, one date format.
- Validate headers against the published input IDs before upload, not after a failed batch.
- Declare per-field behaviour for empty values and enforce it in the template.
- Derive idempotency keys from business keys; keep them stable across resubmissions.
- Sanitise untrusted text at ingest, and prefer JSON when no human needs to open the file.
- Split large catalogues into batches you can retry independently.
- Count rows in, outputs out, failures reported — every batch.
The template is the part everyone reviews. The spreadsheet is the part everyone trusts. Most of the difference between a bulk render that ships and one that limps is decided in the columns before the first row is queued. For multi-market campaigns, the same discipline extends to text expansion and locale-specific fallbacks, covered in localized image and video automation; the typed input contract itself is documented in the JsonCut templates guide.
Sources
RFC 4180, Common Format and MIME Type for Comma-Separated Values (CSV) Files (October 2005) — https://www.rfc-editor.org/rfc/rfc4180 — retrieved 2026-11-25
OWASP Foundation, CSV Injection — https://owasp.org/www-community/attacks/CSV_Injection — retrieved 2026-11-25
Unicode Consortium, FAQ — UTF-8, UTF-16, UTF-32 & BOM — https://www.unicode.org/faq/utf_bom.html — retrieved 2026-11-25
Microsoft Support, Import or export text (.txt or .csv) files — https://support.microsoft.com/en-us/excel/get-started/import-or-export-text-txt-or-csv-files — retrieved 2026-11-25
JsonCut documentation, Typed templates and bulk rendering — https://jsoncut.com/docs/templates/ — retrieved 2026-11-25