CSV comparison, joins and pivots: check records before reporting
Compare keyed differences, lookup joins and pivots with an order-export example. Check duplicate keys, missing values and aggregation rules before applying JSON configuration patches.
Example: reconcile two order exports
An inventory team receives a fresh product export every Monday. Last week product 001 belonged to Design; this week it belongs to Operations and the rows arrive in a different order. A line-by-line diff produces noisy changes. The useful question is whether the record with key 001 changed, which fields changed, and whether any products were added or removed.
Agree on keys and empty values
Start by writing down the key contract. It must identify one record, remain stable across exports and stay in the same representation. Turning 001 into the number 1 breaks that contract even if a spreadsheet displays both similarly. Blank or repeated keys need a deliberate resolution; a tool that arbitrarily chooses one matching row may produce a convincing but incorrect report.
Compare before joining and summarizing
Use keyed comparison before joining the lookup table. For small UTF-8 CSV exports, inspect the added, removed and changed-cell lists plus column-name changes, then download the complete JSON and applicable CSV reports. Neatbo limits each side to 1 MiB; larger tables need another workflow. CSV exports guard formula-like values, while the JSON keeps exact strings for audit. After approving the change set, join the department lookup with a left join when every original product must remain visible. An inner join drops unmatched products by design; that is useful for an intersection report but risky when the report is meant to describe the full inventory.
001,Ada → 001,Ada Lovelace is a changed record, not a deletion plus insertion. A reordered unchanged table should have no changed cells.Keep the evidence behind a report
Only then build the pivot. Run count and sum separately: this tool produces one metric and one row dimension per run. Check the count before summing amounts, inspect a group with no matches and retain a real zero as distinct from a missing combination. If the report is split by department, distribute the ZIP with its manifest: each CSV retains the header and the manifest connects numbered filenames, original group labels and row counts. A final reviewer should be able to trace one source record through comparison, joining and aggregation without guessing which transformation happened.
| Do not rely only on | Also check |
|---|---|
| Equal row counts | Compare key sets and individual fields |
| A successful join | Check lookup uniqueness and unmatched records |
| Equal totals | Check group definitions, empty combinations and numeric precision |
- Keep identifiers as strings and check leading zeroes.
- Sample additions, removals and changes, then reconcile grouped totals.
- Use test conditions in JSON Patch and reject partial edits.
Separate syntax migration from a data contract
Consider a device configuration and an order table arriving together. The device INI contains literal Windows paths, while localized Java Properties messages use backslash escapes. Treating both as generic key=value lines can change the messages even if the resulting JSON looks valid. Choose the correct syntax, retain strings, and check a sample in the receiver.
A static HTML export may be easier to deliver as CSV, but extracting cells does not establish that the data satisfies an import contract. After choosing the right table, define the fields that must be present, the permitted values and numeric limits. A blank optional field differs from a missing required value. Preserve rejected records, use physical line positions for multiline cells, and avoid treating unvalidated columns as approved data.
Separate stored declarations, preserved bytes and confirmed schema
A local migration can contain several distinct contracts: fixed-width code-point fields, workbook formulas with untrusted cache freshness, and CSV columns whose types remain unconfirmed. Extract each explicitly, retain originals and keep suggestions separate from approved import rules.
For supporting files, redact selected JSON values while reviewing visible key names, apply patches against exact coordinates and endings, and retain frontmatter body hashes. EditorConfig and npm lock reports explain the supplied declarations only; do not equate them with editor behavior, installed dependencies or an executable database migration.
References
- CSV and JSON data reconciliation
Reference for the relevant format and processing rules.
- Inspect payloads before applying changes
Reference for the relevant format and processing rules.