Spots

Five edge cases to test before shipping a browser table exporter

A spreadsheet download can look successful while quietly changing the data. An identifier loses its leading zeros, a long number changes precision, or a merged header shifts values into the wrong columns.

While building Local Table Export, we made the

While building Local Table Export, we made the export format and the extraction boundary explicit. Here are five test cases that are useful for any browser-to-spreadsheet tool. 1. Identifiers that look like numbers

Use an example such as 00123. Its meaning

Use an example such as 00123. Its meaning is an identifier, not a quantity. Keep the original string and make text the default column type. Let the person exporting explicitly opt a column into numeric conversion.

Our XLSX writer emits text as an inline

Our XLSX writer emits text as an inline string cell. Numeric conversion is limited to explicitly selected columns, after the header row, and uses a conservative decimal pattern. Values outside that pattern remain text. This intentionally leaves locale-specific values such as 1,234.50 for review instead of guessing their meaning. 2. Values beyond the numeric policy

Test a long digit string such as 90071992547409999

Test a long digit string such as 90071992547409999. Our exporter keeps values with more than 15 digits as text even in a selected numeric column. That is a product decision to preserve the input, not a claim that arbitrary numeric values can be round-tripped safely.

The test should inspect the cell type as

The test should inspect the cell type as well as the visible value. Finding the digits somewhere in the archive is insufficient if the consumer still treats them as numeric data. 3. Formula-looking content

A webpage cell can begin with = or

A webpage cell can begin with = or another character a spreadsheet application treats specially. Do not automatically turn webpage content into workbook formulas.

Our XLSX test checks that the sheet contains

Our XLSX test checks that the sheet contains no formula elements. The CSV path prefixes formula-looking values with an apostrophe. That changes the exported representation, so it is a mitigation with a tradeoff; CSV behavior still needs testing in the spreadsheet applications you support.

Quoting every CSV field solves delimiter escaping. It

Quoting every CSV field solves delimiter escaping. It does not, by itself, establish a column type or guarantee that a consumer will treat the field as literal text. 4. Merged headers and multiline cells

Use a fixture with both rowspan and colspan

Use a fixture with both rowspan and colspan, then check the entire rectangular result. Otherwise a plausible-looking export can put an amount under the wrong heading. Define whether merged positions become blanks or repeat values, and make the behavior consistent.

News

Five edge cases to test before shipping a browser table exporter

A spreadsheet download can look successful while quietly changing the data.

@spots #dev
Source: Dev.to
See more like this