Data workflow

CSV workflows: preserve strings, compare keys and export SQL safely

CSV has fields, not a universal type system. Preserve original strings until an explicit receiving contract tells you which conversions are allowed.

Content updated: · Maintainer and corrections

Parse records, not physical lines

RFC 4180 allows commas and newlines inside quoted fields; a quote inside such a field is doubled. Splitting on commas or line breaks corrupts those records. Choose the input delimiter explicitly. UTF-8 files are decoded strictly; one initial UTF-8 BOM may be removed by the CSV parser.

The column editor rejects blank or duplicate headers and rows with missing or extra fields. It preserves string values, including 001, empty strings, spaces and quoted newlines. Input is limited to 5 MiB, 20,000 data rows, 100,000 cells including headers and 200 columns. The first 100 rows are a preview; export contains the complete selected result.

Make transformations deliberate

Selecting, reordering and renaming columns changes the exported structure, not the original file. The filter uses exact, case-sensitive string equality or containment, not regular expressions or numeric comparison. Review the remaining row count and header order before downloading a new CSV.

A primary-key comparison must identify rows uniquely. Use a composite key when one column is insufficient. Reordering records or columns should not create false data modifications; duplicate keys must be resolved before comparing. Empty key values can collide just like any other string.

CSV and SQL have different safety boundaries

CSV quoting preserves field syntax, but does not neutralize spreadsheet formulas. A value starting with =, +, - or @ may be interpreted by spreadsheet software. These tools do not silently prefix or rewrite values; import untrusted data explicitly as text and follow your spreadsheet's security guidance.

PostgreSQL INSERT exports require explicit table and column identifiers, literal escaping and type choices. An empty CSV string is not automatically SQL NULL. Numeric identifiers can lose leading zeroes when converted, so keep them as text. A generated statement is not executed or a proof that the target database schema will accept it.

Local processing does not make an export anonymous or non-sensitive. Review data before sharing. Inputs are not uploaded, stored or placed in URLs; source edits invalidate previous export results.

id,note
001,"a,b"
002,"two
lines"

-- Preserve identifiers as text:
INSERT INTO "example" ("id") VALUES ('001');

Data provenance

Sources