Converter tool

Combine Same-Named Sheets Across Workbooks

Pick a sheet name such as Jan or Data, and its rows from every workbook are stacked into one sheet, with columns matched by header or position and a column naming the source file.

Line up columns

The first row with a value in each sheet is read as its header row, and rows with no values are skipped. Only values and number formats are copied, so dates stay dates, but formatting is not kept: no fonts, fills, borders, column widths, merged cells, comments or formulas (a formula cell gives the result last saved in its file). Limit: 1,000,000 cells in the output. The workbooks are read by this browser tab and are not uploaded.

Preview

Output Preview

Add two or more workbooks, tick the sheet names to stack, and press Combine to see the row counts, header check and first rows here.

Combine Same-Named Sheets Across Workbooks

Operator: Abdulla Al Fahad. How tools are built and checked

Twelve branch managers each send back the same template, and every workbook has tabs called Jan, Feb and Mar. Head office wants one Jan sheet holding every branch's January rows, one Feb sheet, and so on. Doing it by hand means opening each file, copying the right tab, pasting it under the last block and remembering which rows came from where. With a dozen files and three months that is thirty-six copy-and-paste jobs, and one missed tab is easy to overlook.

This tool does the stacking by sheet name. Add the workbooks, tick the names you want, and for each name the rows of that sheet from every file are placed under one header row, with a Source file column saying which workbook each row came from. A Summary sheet at the end of the result lists how many rows each file gave to each combined sheet, and flags every file whose header row does not match the first one, which is where a renamed or inserted column usually shows up.

Key features

  • A list of every sheet name found, with how many workbooks contain it and which ones do not
  • Names that appear in two or more workbooks are ticked for you
  • Optional matching that ignores capital letters and spaces at either end of a sheet name
  • Columns lined up by header name, or by position for files built from one template
  • A Source file column on every row, and an optional Source row column with the original row number
  • Blank rows skipped and counted for each file
  • A header check for every file, comparing its header row with the first workbook's
  • A Summary sheet listing rows added, blank rows skipped and the header note per file and sheet

Which row is the header, and what is copied

Input is 2 to 50 workbooks in .xlsx or the older .xls format, up to 25 MB each and 200 MB together. Files can mix both formats. A password-protected workbook is turned away with a note to remove the password first, and a so-called .xls that is really a web page or XML export, which some reporting systems produce, is identified as such rather than failing with a vague error.

In each sheet, the first row that holds any value is taken as the header row. Cells that contain only spaces count as empty, so a row of stray spaces above the table is not mistaken for headers. Every row below the header row that has at least one real value becomes a data row; rows with nothing in them are skipped and counted.

The output is a single .xlsx. Each cell's value and number format are copied, so a date stays a date and 0.125 formatted as a percentage still reads 12.5%. Nothing else is: fonts, fills, borders, column widths, merged ranges, comments, hyperlinks and conditional formatting are not kept, and a formula cell arrives as the result that was last saved in its source file. Workbooks that use the 1904 date system, which older Mac versions of Excel defaulted to, have their dates converted so each one keeps its calendar date in the combined sheet.

One run writes at most 1,000,000 cells across all combined sheets, counting the Source file and Source row columns, and no combined sheet can pass Excel's limit of 1,048,576 rows. The page stops with a message naming the limit if a run would go over.

How it works

When you add workbooks, each one is opened just far enough to read its list of sheet names, without parsing any cells. The names are grouped across files: exactly as written by default, or after lower-casing and trimming when you tick the matching option. Under that option a file could, in theory, hold both "Jan" and "Jan " with a trailing space; the first one is used and the other is listed as not used.

When you press Combine sheets, the workbooks are read one at a time in the order shown, and only the chosen sheets of each file are parsed. For each sheet, every cell that holds a value is collected, which also means a used range stretched far down by stray formatting adds no empty rows.

In header mode, each header is trimmed, runs of spaces inside it are reduced to one, and capitals are ignored, so "Unit Price" and "unit price" share a column. The column takes the spelling it had where it was first met. If one sheet has two columns called Amount, the first meets the first Amount column of other files and the second meets the second. A column with values but an empty header cell is called Column D (or whichever letter it sits in) and lines up with other headerless columns in that same letter.

In position mode, column B of every sheet goes into the same output column regardless of its header text. The output header is taken from the first file that has text in that column, and the header check lists each column whose text differs from the first file, such as "B is Qty, first file has Name".

After the last file, SheetJS writes one sheet per chosen name, named as the name was first seen and cleaned to Excel's sheet-name rules, followed by the Summary sheet. The file is called combined-Jan.xlsx when you combine one name, and combined-sheets.xlsx when you combine several.

Common use cases

  • Merging the monthly tabs that each branch fills in from a shared budget template
  • Collecting the Responses sheet from survey workbooks returned by several departments
  • Stacking the Timesheet tab from one workbook per employee into a payroll check
  • Pulling the Data sheet out of a folder of exported reports so a pivot table can cover all of them
  • Building one stock list from the Inventory tab of each warehouse's workbook

How to use this tool

  1. Add the workbooks. Each one shows how many sheets it has, or a reason it cannot be used.
  2. Put the files in the order you want their rows to appear with the arrow buttons; the first file also sets the reference header row.
  3. Check the sheet list. Tick or untick names, and turn on the matching option if some files say JAN and others Jan.
  4. Choose to line up columns by header name or by position, and decide whether you want a Source row column.
  5. Press Combine sheets and read the header check under each combined sheet, along with its first five rows.
  6. Download the workbook and open the Summary sheet to confirm every file contributed the rows you expected.

Example

Three branch workbooks, each with a Jan sheet

north.xlsx  Jan: Date | Item | Qty | Price          3 rows
south.xlsx  Jan: Item | Date | Qty | Price          2 rows with an empty row between them
east.xls    Jan: Date | Item | Qty | Discount       2 rows

combined-Jan.xlsx, lined up by header name

Jan: Source file | Date | Item | Qty | Price | Discount   (7 rows)

Summary
north.xlsx  3 rows  First file with this sheet; other header rows are compared with this one.
south.xlsx  2 rows  1 blank row skipped  Same headers in a different order; matched by name.
east.xls    2 rows  Missing: Price. Extra: Discount.

Tips for best results

  • Move the workbook with the most complete header row to the top. Its headers become the reference that every other file is compared with.
  • If the sheet list shows Jan in 11 of 12 files, read the Missing from column before combining. A tab called January in the twelfth file will not be matched.
  • Turn on Source row when you expect to go back and fix values in the original files; the row number takes you straight to the cell.
  • Use position mode only when every file came from the same template and someone may have retyped a header, such as Qty in one file and Quantity in another.
  • Filter the combined sheet on an empty Source file column cell; there should be none, and any blank cell in a key column points to a short row in one of the sources.

Common pitfalls

A totals row at the bottom of each source sheet is copied like any other row. Filter it out of the combined sheet, or delete it from the sources first, before adding the numbers up.

A title line above the table, such as "North branch, January" in A1, becomes that sheet's header row because it is the first row with a value. The real headers then arrive as a data row. Delete title rows from the sources, or combine and then remove those rows.

Rows hidden in the source, including rows hidden by an AutoFilter, are combined too. The tool reads the stored cells, not what the filter currently shows.

In a merged range only the top-left cell holds the value, so the other rows of a merged label arrive empty. Unmerge and fill the labels in the sources first if those rows need them.

Workbooks written by some scripts store formulas without a saved result. Those cells come out empty, because nothing is recalculated here; open and save such a file in Excel first.

Header matching ignores case and spacing but not wording. Qty and Quantity become two columns in header mode, and the header check lists both as missing or extra.

Common errors and how to fix them

"... is a web page or XML file with an Excel file name, not a real workbook."
The file ends in .xls but holds HTML or XML, which some systems use for report downloads. Open it in Excel, choose Save As, pick Excel Workbook (.xlsx), and add the saved copy.
"... is protected with a password."
A workbook that needs a password to open is stored encrypted, so its sheets cannot be read. Open it in Excel, remove the password from the protection settings, save, and add it again.
No sheet name is ticked and the page says no name appears in more than one workbook.
The tab names differ between files. If they differ only in capitals or outer spaces, tick the matching option. If they are spelled differently, such as Jan and January, rename the tabs in the sources so they agree.
The page says the combined sheets would hold more than 1,000,000 cells.
Combine fewer sheet names per run, or split the workbooks into two batches and combine the two results afterwards.

Best practices

  • Keep the Summary sheet with the combined data; it records which files and rows went into each sheet.
  • Check the rows-added figures against what each branch says it sent before using the totals.
  • Fix header differences in the source templates so next month's run produces a clean header check.
  • Keep the original workbooks. The combined file has values only, so it cannot replace them.

Header name or position: which one to pick

Header mode is the safer default. It copes with files where someone inserted a column or dragged Price in front of Qty, because each value follows its header. Its weakness is wording: a header typed as Qty in one file and Quantity in another becomes two half-empty columns, which you will see straight away in the combined sheet and in the header check.

Position mode suits a locked template where the layout cannot change but people sometimes retype or translate the header text. It puts column C under column C no matter what the header says, so it never splits a column because of wording. Its weakness is the reverse: if one file has an extra column inserted, every column to the right of it lands one place off. The header check lists each position where the text differs, so read it before trusting the numbers.

What the Source file column holds

The cell holds the workbook's file name as it was added. If two workbooks share a name, for example two files called report.xlsx from different folders, the second is labelled report.xlsx (2) in both the combined sheets and the Summary sheet, so the rows stay traceable. The column is always first, followed by Source row when that option is on, and then the data columns.

Frequently asked questions

Can I combine several sheet names in one run?

Yes. Tick as many names as you like; each becomes its own combined sheet in the same workbook, followed by one Summary sheet covering all of them.

What happens to a workbook that lacks one of the chosen sheets?

It adds no rows to that combined sheet, and the Summary sheet lists it with "(not in this file)" so the gap is recorded rather than silent.

Are formulas kept?

No. Each formula cell arrives as the value that was last saved in its source workbook. The combined sheet holds plain values, which is usually what a pivot table or an import needs.

Are my workbooks uploaded anywhere?

No. Each workbook is opened from your disk by this tab and stacked by the SheetJS library running in it, and the combined file reaches your downloads through a short-lived link created in the tab. No sheet data is kept in localStorage, sessionStorage or IndexedDB either.