The columns match. The data is fine. But one file starts with a company name and a reporting period, another has a blank row and a logo, and a third begins straight with the headings. Anything that assumes “row 1 is the header” gets at least two of them wrong.
Three files, the same table, three different starting rows
north.xlsx · headings on row 1
| A | B | C | |
|---|---|---|---|
| 1 | Customer | Amount | Month |
| 2 | Acme Ltd | 480.00 | Oct |
| 3 | Halden & Co | 310.00 | Oct |
south.xlsx · headings on row 4
| A | B | C | |
|---|---|---|---|
| 1 | South region sales | ||
| 2 | Period: October | ||
| 3 | |||
| 4 | Customer | Amount | Month |
| 5 | Brook Supplies | 320.00 | Oct |
west.csv · headings on line 3
| A | B | C | |
|---|---|---|---|
| 1 | Exported 2026-10-31 09:14 | ||
| 2 | |||
| 3 | Customer | Amount | Month |
| 4 | Marlow Foods | 150.00 | Oct |
| Customer | Amount | Month | Source File | |
|---|---|---|---|---|
| 2 | Acme Ltd | 480.00 | Oct | north.xlsx |
| 3 | Halden & Co | 310.00 | Oct | north.xlsx |
| 4 | Brook Supplies | 320.00 | Oct | south.xlsx |
| 5 | Marlow Foods | 150.00 | Oct | west.csv |
What goes wrong when the header row moves
Most combine methods assume the first row of every file holds the column names. When it doesn’t:
- The title becomes the heading. “South region sales” is promoted to a column name, and the real headings arrive as a row of data.
- Columns go missing. Tools that combine by column name find no “Customer” column in south.xlsx, so its rows are left blank or dropped.
- Junk rows appear in the data. “Period: October”, blank rows and export timestamps end up as records, and filters and pivot tables stop making sense.
- A fixed “remove top rows” step breaks. Deleting three rows fixes south.xlsx, deletes two real records from north.xlsx and leaves the timestamp in west.csv.
A moved header row is one of the most common forms of spreadsheet schema drift: the data hasn’t changed, but its position on the sheet has.
What usually sits above the table
| Content | Example | Treat as |
|---|---|---|
| Report title | South region sales | Layout: skip |
| Metadata | Period: October; Prepared by Finance; Exported 2026-10-31 | Layout: skip, or capture separately if you need it |
| Blank rows and spacers | An empty row under the title | Layout: skip |
| Grouped or two-row headings | “2026” above “Q1 | Q2 | Q3” | Needs flattening into one header row first |
| A second table | Assumptions or exchange rates beside the data | A separate table: choose which one to use |
Method 1: by hand in Excel
Fine for three files. Tedious for thirty, and it has to be repeated every time a new batch arrives.
Method 2: Power Query, finding the header row by content
Instead of removing a fixed number of rows, load each sheet without headers, find the row that contains a heading you know will be there, skip everything above it, then promote headers. As a function you can apply to every file in a folder:
(raw as table) as table =>
let
Position = List.PositionOf(Table.Column(raw, "Column1"), "Customer"),
Result = if Position < 0
then error "Header row not found"
else Table.PromoteHeaders(Table.Skip(raw, Position),
[PromoteAllScalars = true])
in
Result
- Load each workbook with
Excel.Workbook([Content], false)so nothing is promoted too early, then pass the sheet’s[Data]to the function. - This version looks for “Customer” in the first column. If the anchor heading can be in any column, search each row instead.
- Raising an error when the heading isn’t found is deliberate: a file that silently loads nothing is worse than one that stops the refresh.
- Apply it in the Transform Sample File query, or call it per file, so every file is handled on its own rather than all files sharing one fixed offset.
Method 3: Python
import pandas as pd
raw = pd.read_excel("south.xlsx", header=None)
header_row = raw.index[raw.eq("Customer").any(axis=1)][0]
df = pd.read_excel("south.xlsx", header=header_row)
Read once without headers, find the first row containing the anchor heading, then read again from that row. Loop over the files, add a Source File column, and combine with pd.concat.
Method 4: ConsoliSheet
ConsoliSheet looks for the coherent table in each file separately, even when a worksheet contains title rows, spacers or separate calculations. Each file can start on a different row; the headings are found for each one. Where a sheet holds more than one plausible table, or the header row is genuinely unclear, you are asked to choose rather than having one picked for you. Columns are then lined up by heading, and every output row keeps its Source File.
Checks after combining
- No title text in the data. Filter the first column for words like “Report”, “Period” or “Total”.
- No repeated header rows. A row reading “Customer | Amount | Month” in the middle of the data means a file was combined from the wrong row.
- Row counts reconcile. Output rows should equal the data rows in each file, not including titles, blanks and totals.
- Totals reconcile. Each file’s total should match its rows in the output.
Common questions
How do I merge Excel files when the header row is in a different place?
Find the header row in each file by its content, for example the row containing “Customer”, skip everything above it, then combine the files by column heading. Avoid removing a fixed number of rows, because that only works when every file has exactly the same layout above the table.
Why does Power Query use my title as the column name?
Because it promotes the first row to headers. When a title sits above the table, that title becomes the heading. Load without promoting headers, skip the rows above the real header, then promote.
How do I remove title rows from multiple Excel files at once?
If every file has the same number of title rows, Power Query’s Remove Top Rows works for all of them. If the number varies, locate the header row by content in each file, as shown above, or use a tool that detects the table in each file separately.
What if a sheet has two tables on it?
Decide which one you need before combining. A summary or assumptions table beside the main data should not be appended as rows. ConsoliSheet asks you to choose when a sheet holds more than one plausible table.
Can I combine CSV files that have lines above the header?
Yes, by finding the real header line first. Exports often start with a report name or timestamp. Read the file, locate the line containing the expected headings, and parse from there.
Related: combining Excel files with different column names covers what to do once the tables are found but the headings differ, and Power Query Combine Files problems covers the other ways a folder combine breaks.
Got files like these?
Upload them as they arrived. ConsoliSheet looks for the table in each one, even below title rows, and shows you how the columns line up before anything is combined.
Free for up to 5 business columns. No account needed.