Data workflow guides

Join two CSV exports without losing leading zeros

·

An inventory CSV identifies items by sku and a price CSV calls the same field code. The order of the exports differs. Join on the text keys, inspect duplicate price rows and compare the result with a positional column splice.

CSV Joiner

Match the code and sku columns

Load the built-in examples and read the column names. The default Left join uses sku on the left and code on the right. Both price records with code 001 match the inventory row. Its quoted label contains a newline, which stays inside one field.

Run the join and check for four output rows. Item 001 appears twice, with prices 1.2300 and 1.2500. Items 002 and 004 keep their inventory labels and have empty fields for price and note. A plain-text editor shows that the exported keys keep their leading zeros.

Expected rows after a Left join
sku,label,price,note
001,"First
line",1.2300,"red, large"
001,"First
line",1.2500,blue
002,Second,,
004,Fourth,,

RFC 4180 — CSV records and quoted fields

Keep a price code with no inventory row

Change Join method to Full outer join and run it again. The fifth row contains 003 in sku, no inventory label, and a price of 5.00. Clear the note checkbox if the receiver needs only the price column from the right table.

If an expected match is missing, compare the two key cells as text. Leading zeros, letter case and spaces matter. Blank keys remain unmatched. If a spreadsheet displays 001 as 1, import the key column as text before comparing.

RFC 4180 — CSV records and quoted fields

Check whether row order is enough

Use Splice columns by row when two extracts have corresponding records in matching order. In this example, the second inventory record has sku 002 and the second price record has code 001. A positional splice aligns those two values, so the key join fits this inventory task.

RFC 4180 — CSV records and quoted fields

Common questions

Do the two inputs have to use the same separator?

Choose a separator independently for each input. Comma, tab, semicolon and pipe are available. The export uses commas.

What happens when a selected field name exists in both tables?

The left header stays as supplied. The right header receives a suffix such as (right) so each output name is distinct.

Sources

Put it into practice.

Related guides