Get the local build — $9
mergingheaders

When every file has the same headers (the easy case, done properly)

Same headers in every file means the merge is almost trivial — which is exactly why people skip the check and end up with two columns called Amount, one of them empty. Identical on screen is not identical as a string.

Identical means byte-identical after normalization

Amount, Amount (trailing space), Amount with a U+3000 full-width space, and AMOUNT are four different strings. They render the same in every font, and a name-based merge treats them as four columns — three of which are mostly empty.

Normalize header names before matching: strip, replace U+3000 and U+00A0 with a normal space, collapse runs of spaces, and decide a case policy. Headers are labels, not prose, so removing whitespace entirely is also defensible — as long as you do it consistently on every file.

Fingerprint the headers before merging

Print each file's header list, sorted, with a count. Files with the same fingerprint merge cleanly. The odd one out is the file you want to open by hand, and finding it takes one glance instead of one afternoon.

Do this even when you are sure. The cost is ten seconds; the failure it prevents is a mostly-empty column that nobody notices until the report is sent.

What still goes wrong with matching headers

Duplicate header names inside one file (Amount twice) are the classic one: the map keeps the last, so half your amounts vanish. Rename one before merging.

A header on row 3 in one file and row 1 in the rest is not a header problem at all — it is a detection problem, and it looks like a header mismatch until you print the detected row number.

Step by step

  1. Print the sorted header list per file and compare fingerprints; investigate any file that differs.
  2. Normalize header whitespace on every file (U+3000, U+00A0, trailing spaces) before merging.
  3. Check for duplicate header names inside a single file and rename one.
  4. Merge, then read the output header: it should be exactly one copy of your column list, plus the source columns.
  5. Verify the row count: sum of per-file data rows must equal the merged row count.

The command, concretely

python sheetkit.py headers ./monthly
# 2024-01.xlsx  6 cols  Date | Store | Amount | Note | Qty | Ref
# 2024-02.xlsx  6 cols  Date | Store | Amount | Note | Qty | Ref
# 2024-03.xlsx  7 cols  Date | Store | Amount | Note | Qty | Ref<U+3000> | Approved by
#                        ^ trailing full-width space, and one extra column

python sheetkit.py merge ./monthly -o merged.xlsx
# 12 files / 4,318 rows / 7 output columns (union)

What goes wrong

Assuming the merge tool is the problem

When one column comes out half empty, the header in one file is different. Check the strings, not the tool.

Case-only differences

Qty and QTY merge into two columns unless you pick a case policy. Pick one and apply it to every file, including the ones you think are fine.

Header rows that are not row 1

Detection picks the row with the most short text cells in the first eight. Print it per file — a file where it picked row 4 will otherwise look like a header mismatch.

Questions people actually ask

Is it safe to remove all spaces from header names?

Yes, as long as you do it to every file before matching. Keep a display-name mapping if you need the original labels in the output.

Do the columns have to be in the same order?

No. Matching is by name, so order does not matter — that is the whole reason to match by name rather than position.

What if one file has an extra column?

It becomes an output column that is empty for the other files. That is correct and visible; decide whether to keep it or drop it before building the report.

Do it now, in this browser

Drop the folder in, check the detected header, merge. Nothing is uploaded — the file is processed in the tab. Free for one-off merges; the unlimited local build is $9.