Appending rows from many Excel files
Appending is the simplest merge there is: same columns, more rows, nothing aggregated. It is also where most silent corruption happens, because appending by column position instead of by column name turns a harmless column reorder into wrong data.
Append, merge, consolidate — pick the right verb
Append: same schema, rows stacked, row count grows, nothing is summed. Merge: same thing, usually said of files rather than rows. Consolidate: rows are grouped by a key and aggregated, so the output has fewer rows than the input. If someone asks you to "combine these and tell me the total per branch", they want consolidate, and appending alone will not answer it.
Appending is the safe first half of consolidating: get every row into one sheet with a source column, then group.
Why position-based appending breaks
January is Date, Store, Amount. March is Store, Date, Note, Amount. Appending positionally puts March's store name in the date column. The result looks like a normal table, sums to a plausible number, and is wrong.
Name-based appending writes each value under its own header. A file that lacks a column leaves that cell empty — visible, honest, and fixable. A shifted cell is invisible.
Keep the provenance
Every appended row should carry its origin: Source file and Source sheet. When a number looks wrong three weeks later, that column is the difference between a two-minute check and an afternoon of reopening workbooks.
Step by step
- Put the files in one folder and check they are all .xlsx — convert any old .xls first.
- Append with header detection on; read which row was chosen per file.
- Compare the output header with your expected column list. Anything unexpected is a source file with a different header.
- Sort by
Source fileand confirm each file contributed the row count you expect. - Only then group or pivot. Appending and aggregating in one step hides errors.
The command, concretely
python sheetkit.py merge ./weekly -o appended.xlsx
# 8 files / 1,904 rows
# columns: Date | Region | Rep | Amount | Note | Source file | Source sheet
# rows with Note empty: 611 <- only the files exported after the template change
What goes wrong
Appending a file twice
Re-running the job with last week's output still in the input folder doubles every row. Write the output to a different directory, or skip files by name.
Trailing total rows
Many exports end with a Total row. Appended naively it becomes a data row whose amount is the sum of everything above it, doubling your revenue. Drop rows whose first cell is a total label.
Excel tables and named ranges
A ListObject does not survive an append; the output is a plain range. If downstream formulas reference a table name, recreate the table over the new range.
Questions people actually ask
Can I append files with different columns?
Yes. The output is the union of all headers; files missing a column leave those cells empty, which is exactly what you want to see.
Does the row order matter?
Only for reading. Append in file order, then sort by a date column if you need chronology — sorting by Source file keeps the file grouping visible.
What about duplicate rows across files?
Appending does not deduplicate. After appending, drop whole-row duplicates and report rows that share a key but differ elsewhere.
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.