Skip to content

Systems and records

Long record truncation dataset validation: 120 round trips, 35 cuts

By SourceX Editorial · Updated

10 sections

Short answer

Long record truncation dataset validation needs value-level checks, because export tools cut text quietly. A test pushed 12 synthetic records through 10 export paths at pinned versions: every XLSX route, including pandas, openpyxl, XlsxWriter and LibreOffice, cut each value over 32,767 characters to exactly 32,767, while Python's csv reader refused fields over 131,072. Ship each long value's length and hash, and recompute both after the buyer loads it.

Checklist

Long record truncation

This page covers long record truncation dataset validation: 120 round trips, 35 cuts.Illustrative

Key takeaways

  • In 120 round trips, all 35 truncations happened in the five XLSX routes, each cutting values over 32,767 characters to exactly 32,767.
  • Only pandas warned; XlsxWriter returned a code, openpyxl and LibreOffice said nothing, and every file still opened normally.
  • Python's csv reader refused fields over 131,072 characters by default, a loud failure that is safer than a quiet cut.
  • A spike at a cap cannot separate a genuine 32,767-character value from a cut one; only the source length and hash can.
  • Declared column sizes prove nothing: SQLite kept 200,000 characters in a VARCHAR(255) column, which PostgreSQL or MySQL would reject or cut.

What should a long record truncation check prove?

It should prove that every long text value arrives with the same length and content it left with, after loading in the format the buyer will actually use. File-level checks cannot show that: a spreadsheet can open, match its checksum and hold the right number of rows while every long comment inside it ends mid-sentence.

Three facts settle it for each long field: the value's length in characters and bytes at the source, a marker or hash that shows whether the end survived, and the documented cap of every tool the value passed through. Collect them at export, recompute them after the buyer's load, and the question has an answer instead of a sample.

This is narrower than a cut-off file or a missing batch of records, which the site's corruption and completeness checks cover. A field-level cut leaves the file whole and the row count right, so it survives both of those checks.

Where long text gets cut: limits the tools document themselves

Most cuts happen at limits the tools publish, so the first step is a written inventory of the caps on the path from source system to training loader. The list below comes from each publisher's own documentation or source code, read on October 28, 2026; the right-hand column is what a delivery engineer would actually see when a value crosses the line:

Where long text gets cut: limits the tools document themselves
Tool or formatDocumented limitWhat happens past itSignal a pipeline sees
Excel worksheet cell32,767 characters per cell (Microsoft specifications)The format cannot hold moreDepends on the tool that writes the file
XlsxWriter 3.2.932,767 characters; Excel displays only 1,000 in a cellwrite_string() truncates the stringReturn code -2
openpyxl 3.1.532,767 characters, enforced in its cell codeValue sliced to 32,767None
pandas 3.0.5 to_excel32,767 characters, citing Excel's limitWrites through the engine, which cutsUserWarning naming the original length
Python 3.13.16 csv readerDefault field limit 128 x 1024 = 131,072Reading stopsError: field larger than field limit
PostgreSQL varchar(n)n characters, not bytesError on insert; an explicit cast truncates silentlyError, or nothing after a cast
MySQL 8.4 VARCHARDeclared column lengthError in strict mode; truncation outside itWarning when strict mode is off
SQLiteDeclared length ignoredValue stored wholeNone, and no protection downstream

What 120 round trips through 10 export paths showed

Every XLSX route cut every value longer than 32,767 characters to exactly 32,767, and only one route said so in a way a pipeline would notice. The test pushed 12 deterministic synthetic records through 10 export paths installed in one environment, one record per file, and read each back. Lengths ran from 254 to 200,000 characters; one 40,000-character record used a two-byte character, giving 79,985 bytes in UTF-8.

Of the 120 round trips, 83 came back intact, 35 were truncated and 2 failed loudly. All 35 cuts were in the five XLSX routes, seven records each, and every cut value lost its end marker. The record of exactly 32,767 characters survived everywhere. The two-byte record was cut at 32,767 characters, which is 65,523 bytes, so the limit counts characters, not bytes.

The loud failures came from Python's standard csv reader, which refused the 131,073- and 200,000-character fields with its default limit and read them fine once the limit was raised. A refusal is the better failure: it stops the load instead of handing over a shortened sentence. Here is the result by route:

What 120 round trips through 10 export paths showed
Export path and versionValues cut or refusedResult past the capSignal raised
XlsxWriter 3.2.9 write_string, read back with openpyxl7 of 12 cutExactly 32,767 characters keptReturn code -2 only
openpyxl 3.1.5 cell write7 of 12 cutExactly 32,767 characters keptNone
pandas 3.0.5 to_excel, xlsxwriter or openpyxl engine7 of 12 cut in eachExactly 32,767 characters keptUserWarning: Cell contents too long
LibreOffice 24.2.7.2 headless CSV to XLSX7 of 12 cutExactly 32,767 characters keptNone; conversion exited normally
Python 3.13.16 csv reader, default limit2 of 12 refusedNo value returnedError: field larger than field limit (131072)
pandas read_csv, csv with raised limit, JSON, SQLite VARCHAR(255)0 of 12All values intactNone needed; SQLite kept 200,000 characters in a 255 column
A grid of six export rows against six original value lengths from 4,000 to 200,000 characters: the XLSX writers (XlsxWriter, openpyxl, pandas and LibreOffice) cut every value from 32,768 characters upward, Python's default csv reader refuses the two longest, and CSV with a raised limit, JSON and SQLite keep everything.
Six of the twelve tested lengths, by export path; the two pandas engines are shown as one row.

A pile-up at the cap is a clue, not a verdict

A pile-up at a known cap says where to look; only the source length says whether a value was cut. In every XLSX output the simple spike test flagged the cap: eight values sat at exactly 32,767 characters and none was longer. One of those eight was genuinely 32,767 characters long and intact. Nothing inside the file can tell it apart from the seven that were cut.

That is why the manifest has to carry each long value's original length and hash. With them, the check is exact: a value whose loaded length or hash differs from the manifest was altered, whatever its length. Without them, a reviewer is left guessing from a histogram, and a dataset of naturally capped values, such as text from a system that never accepted more, looks identical to a damaged one.

Previews add a second false alarm. With default settings, the pandas preview of a 254-character value showed 49 characters ending in an ellipsis while the stored value kept all 254, and XlsxWriter's documentation notes that Excel shows only 1,000 characters inside a cell although it stores 32,767. Measure stored length; never judge truncation by eye.

Characters, bytes and values that were cut before export

Some limits count characters, some count bytes, and some apply before the export ever runs. PostgreSQL defines varchar(n) in characters, not bytes, and the Excel-bound tools tested here cut at 32,767 characters regardless of encoding. Byte-based limits elsewhere in a pipeline, such as fixed-width fields or storage pages, would cut the two-byte record far earlier, so the manifest should record both counts.

Source systems impose their own caps. Slack's chat.postMessage method truncates messages longer than 40,000 characters and returns a message_truncated warning. A pile-up at 40,000 in a message export is therefore the system's rule at the moment of writing, not a delivery defect, and nothing downstream can restore what Slack never stored. Record such caps as source limits, so a buyer can see that the values were bounded at birth rather than damaged in transit.

The distinction changes the remedy. A delivery cut is fixed by re-exporting in a format without the cap. A source cap cannot be fixed at all; it can only be disclosed, and a buyer decides whether bounded text still fits the task.

Why a file that opens and a checksum that matches prove nothing here

Because truncation happens before the checksum is taken. The strongest alternative explanation for a clean intake report is that the file is fine: it opens, the transfer hash matches and the row count reconciles. In the test, all five XLSX routes produced files that opened and read back without error, and each would have matched its own checksum perfectly, with seven of twelve long values shortened inside.

Declared schemas mislead in the same way. SQLite stored a 200,000-character value in a column declared VARCHAR(255), and its documentation says the number in a type declaration is ignored. Loaded into PostgreSQL as varchar(255), the same value would raise an error on insert, or be cut silently if someone cast it explicitly. Loaded into MySQL with strict mode off, it would be truncated with only a warning. The declared length tells a buyer nothing about what is inside; the measured maximum does.

The long-field manifest and acceptance checklist

The asset has two parts, shown below in this order: a five-step acceptance checklist, then the manifest section every free-text column needs. The manifest records what the source held and the checklist proves the buyer's copy still holds it; both work on any export path, because they measure values instead of trusting tools:

Checklist · 5 items

  1. Before export, compute max_chars and max_utf8_bytes for every text column and compare them with each documented cap on the path; reject any route whose cap is below the maximum.
  2. Write the long-value index: key, length and SHA-256 for each value above the threshold, which the buyer and supplier agree in advance.
  3. After packaging, reload the package with the buyer's loader and recompute lengths and hashes for every indexed value.
  4. Accept only when every indexed value matches; investigate any column with values sitting exactly at a known cap.
  5. Log every warning and return code from the export tools; a silent tool still leaves a trail in the comparison.

0 of 5 ticked. Tick each item as you go.

The long-field manifest and acceptance checklist
Manifest fieldWhat it recordsCheck it enables
max_chars and max_utf8_bytesLongest value in characters and in bytes, at the sourceCompare with every cap on the path before choosing a format
count_at_known_capsValues sitting exactly at 255, 4,000, 32,767, 40,000, 65,535 and 131,072Flags a cap for review without calling it a defect
long_value_indexRecord key, length and SHA-256 for every value above an agreed thresholdExact per-record comparison after loading
source_capAny limit the source system applied when the text was writtenSeparates bounded-at-birth text from delivery damage
export_pathEach tool and version between source and packageReproduces the route, and the cut if there was one
consumption_testFormat, loader and version the buyer will use, and the result of the round tripProves the values survive the buyer's actual load

Long record truncation dataset validation in the buyer's own loader

Run the round trip in the loader the buyer will train or evaluate with, not in the supplier's preferred tool. The test shows why: the same 200,000-character value survived pandas read_csv, JSON and SQLite, failed Python's default csv reader, and lost 167,233 characters in every XLSX route. The format a supplier ships and the format a buyer loads decide the outcome together.

For any field that can exceed 32,767 characters, XLSX is the wrong delivery format, whatever tool writes it. CSV can carry the value, provided the buyer's reader raises its field limit and the file follows quoting rules for embedded line breaks. JSON Lines carried every value here; columnar formats were not tested and should go through the same round trip before anyone relies on them.

Making no-truncation an acceptance term

State it in the requirement: no text field may be shortened, every free-text column ships with lengths and hashes for long values, and acceptance means the indexed values match after the buyer's own load. That turns a vague quality expectation into a test both sides can run.

SourceX's request page asks AI teams to share scope, volume, language, format, timing and licensing, which is the place to name the consumption format and attach the round-trip test. On the supply side, the Dataset Deal Confirmation fixes the exact dataset before the opportunity is presented to anyone outside, so a length index agreed at that point describes the very records that will be prepared. How a given source system caps its text is a fact to establish per supplier, not something a request can presume.

Methods note: how the round trips were built and scored

Environment, October 28, 2026: Python 3.13.16, pandas 3.0.5, openpyxl 3.1.5, XlsxWriter 3.2.9, SQLite library 3.45.1 and LibreOffice 24.2.7.2, with Python's csv field limit at its default of 131,072. Records: 12 synthetic values with no personal data and no randomness. Each is exactly L characters: a prefix [rNN|L] (rNN is the record id, r01 to r12), the pattern abcdefghij repeated, and the end marker |END. L is 254, 255, 256, 4,000, 32,767, 32,768, 40,000, 65,536, 131,072, 131,073 or 200,000; a twelfth record of 40,000 characters uses the two-byte character U+00E9 instead of the pattern.

Paths: each record written to its own file per path and read back; XLSX files were read back with openpyxl, directly in read-only mode or through pandas read_excel; the raised-limit CSV path set the field limit to 2,147,483,647; the LibreOffice route converted a two-column UTF-8 CSV to XLSX with the default export filter; SQLite used an in-memory table with a VARCHAR(255) column. Scoring: intact means equal to the original; truncated means shorter and a prefix of the original; error means the write or read raised an exception. No altered outcomes occurred. The spike test flags a cap when two or more values sit exactly on it and none is longer.

Documented limits come from the publishers' pages and source files listed below; Microsoft, MySQL, SQLite and Slack were verified through search excerpts of their own domains. Not tested: Excel itself, Google Sheets, Parquet, PostgreSQL and MySQL servers, and any real dataset. The script, xs0938_roundtrip.py, and its JSON output are kept for recount.

Frequently asked questions

What is the maximum length of text in an Excel cell?

Microsoft's Excel specifications list 32,767 characters as the total a cell can contain. XlsxWriter's documentation adds that Excel displays only 1,000 of them inside the cell, so a value can look shorter on screen than it is in the file.

Does converting a CSV file to XLSX cut long text?

In this test it did: LibreOffice 24.2.7.2 converted a CSV holding values up to 200,000 characters and kept exactly 32,767 of each longer value, finishing without an error. Excel itself was not tested, but the format's own cell limit is the same.

Why does Python's csv module fail on a very long field?

Its reader has a default field limit of 128 times 1,024, or 131,072 characters, set in CPython's csv source. Longer fields raise an error until the limit is raised with csv.field_size_limit, after which the 200,000-character test value read back intact.

How can I tell real truncation from a preview that looks cut?

Measure the stored length and compare it with the length recorded at the source. A pandas preview showed 49 characters of a 254-character value that was fully intact, so screen output is never evidence either way.

Should a dataset manifest include per-record hashes for long text?

Yes, for every value above a threshold both sides agree in advance. Per-record length and SHA-256 are the only evidence that separates a value genuinely sitting at a cap from one that was cut there.

Sources

  • Microsoft's Excel specifications list 32,767 characters as the total number of characters a cell can contain. Source
  • CPython's csv module sets its default field limit to 128 x 1024 characters and raises 'field larger than field limit' for longer fields. Source
  • XlsxWriter documents that strings longer than 32,767 characters are truncated by write_string(), which returns -2, and that Excel displays only 1,000 characters in a cell. Source
  • openpyxl 3.1.5's cell code slices every string to 32,767 characters before writing. Source
  • pandas 3.0.5 warns 'Cell contents too long, truncated to 32767 characters' when writing longer strings to Excel, citing Excel's limit. Source
  • PostgreSQL's documentation says varchar(n) limits are in characters, that over-length inserts raise an error, and that an explicit cast truncates without error. Source
  • MySQL's manual says that without strict SQL mode an over-length CHAR or VARCHAR value is truncated with a warning, and strict mode turns it into an error. Source
  • SQLite's documentation says numeric arguments in a type declaration such as VARCHAR(255) are ignored, so lengths are not enforced. Source
  • Slack's chat.postMessage documentation says messages longer than 40,000 characters are truncated and a message_truncated warning is returned. Source
  • SourceX's request page asks AI teams for scope, volume, language, format, timing and licensing needs. Source
  • SourceX's how-it-works page says a Dataset Deal Confirmation fixes the exact dataset before the opportunity is presented externally. Source

Tell us what data you need

Share scope, volume, format, timing and licensing needs. Datasets are sourced on request.

See if your company qualifies