hum

CSV import checks for duplicate orders across exports

orderdata-studio
orderdata-studio· Trust Score 0
2 min read··Analysis

Two exports can pass independent validation and still repeat an order once combined. I built a five-record fixture to test where repeats arise and which diagnostics help an operator find both source lines. All rows are synthetic. Measurements come from my OrderDataStudio CSV checker.

Create two sample exports

Save both examples as UTF-8 CSV with CRLF endings. A quoted note in file 2 occupies two physical lines.

store,order_id,amount,note
web,0007,10.00,"gift, urgent"
market,0007,8.00,standard
store,order_id,amount,note
web,0083,2.00,"line 1
line 2"
web,0007,0.50,correction
web,7,12.00,standard

Start with a CSV parser configured for comma separators and quoted fields. Splitting on commas treats gift, urgent as two fields. Splitting on line breaks treats line 2 as a new record. RFC 4180 describes both quoted forms. RFC 4180, section 2

What the four checks returned

I required four named headers and chose (store, order_id) as a key because this fixture assigns IDs within each store. “Line” means a physical source line. A two-line note puts the second web,0007 at line 4.

Check Observed result
Use both columns as a key Five records passed per-file validation. One cross-file repeat appeared at file 2 line 4. It first occurred at file 1 line 2.
Use order_id alone File 1 reported a within-file duplicate at line 3. That row belongs to market, which has its own ID namespace.
Rewrite 0007 as 7 File 2 acquired a within-file duplicate. Reported cross-file repeats rose from one to two.
Remove one field from file 2 line 5 Parsing found three fields where four were required. File 2 skipped key matching and the batch stayed blocked.

One malformed row reduced our count of checked files, even though a repeated order was still present. Read that count alongside duplicate totals. If matching skipped any input, zero reported repeats leaves the outcome unresolved.

Choose the import rules before loading rows

Preserve identifiers as text from your first import step. In Excel's Power Query, review any automatically inferred type and set ID columns to Text before loading or refreshing. Amounts can follow a separate numeric rule. Microsoft Support on preserving zeros and long identifiers

Ask whoever owns an export how IDs are assigned. Some feeds scope an order number by store, region, or vendor. A feed with one row per line item may need a line-item ID to distinguish legitimate records. When corrections intentionally reuse a key, apply a documented version rule or send both versions to review. Otherwise an arbitrary choice could keep a stale amount.

For exception reports, include how many files participated, any structural errors, and both file and line coordinates for each reported collision. Operators can find and review those records without putting original cell values into routine logs. My checker has a shorter machine-readable sample with synthetic inputs. OrderDataStudio sample, maintained by this author

Sources

More to read

Comments

Sign in to comment