How do you merge CSV files on a Mac?

By Kayabyte · Last updated 2 November 2026

To merge CSV files on a Mac, join them in Terminal so the header appears only once: awk 'FNR==1 && NR!=1 {next} {print}' *.csv > ../merged.csv keeps the first file’s header row and drops it from every other file. That is fast for files with identical columns, and it breaks on different columns, mixed encodings and CSVs that do not end with a line break. Gridhand stacks the rows by header text and writes a .xlsx; Convert can then write that sheet back out as a CSV. If you want an Excel workbook with a tab per CSV instead, see combine CSV files into one Excel workbook.

Method 1: Terminal with awk

Open Terminal, go to the folder with the CSVs (cd ~/Documents/csvs) and run:

awk 'FNR==1 && NR!=1 {next} {print}' *.csv > ../merged.csv

The output goes one folder up so that it is not read as an input. FNR is the line number inside the current file and NR the number over all files, so line 1 of every file except the first is skipped. awk also adds a line break after a last line that lacks one, which avoids two rows being glued together.

Method 2: cat or tail with the header written once

head -n 1 first.csv > ../merged.csv writes the header once. Then for f in *.csv; do tail -n +2 "$f" >> ../merged.csv; done appends every file without its first line (tail -n +2 starts at line 2). Here a file without a final line break does glue its last row to the next file’s first row, so check the end of each file or use awk.

Pitfalls

Manual route in Excel or Numbers

Open each CSV, copy its rows without the header and paste them under the first file’s rows. Numbers works the same way: open each CSV, copy the rows and paste them under each other. This is fine for 3 files and slow for 30. For the Excel side of the job, see combine Excel files into one sheet.

With Gridhand

Gridhand reads CSV, TSV and text files in Convert, with encoding (BOM, UTF-8, UTF-16, Windows-1252) and delimiter (comma, semicolon, tab, pipe) detected, and IDs with leading zeros kept as text. Merge works on workbooks, so the route is two steps: Convert the CSVs to .xlsx, then Merge them “Into one sheet (stack the rows)”. Merge finds each header row, matches columns by header text ignoring case and spaces, keeps columns that only some files have, and can add the source file as a column. The output is an .xlsx file. Originals are never modified.

To get a CSV back, add the stacked .xlsx to Convert in “XLSX to CSV” mode: it writes one CSV per sheet, with the delimiter, encoding and line endings you choose. Dates are written as yyyy-mm-dd and formulas as their saved result.

Steps with Gridhand

  1. Drop the CSV files into Gridhand, choose Convert, “CSV, TSV or text to XLSX”, check the encoding and delimiter in the preview, and run it with one .xlsx per CSV.
  2. Add the new .xlsx files to Merge and choose “Into one sheet (stack the rows)”, with the source file option ticked if you want to see where each row came from.
  3. Check the preview, choose an output folder and press Run.
  4. For a CSV, add the merged .xlsx to Convert, choose “XLSX to CSV”, set the delimiter and encoding, and run it.

Free for up to 3 input files per run, so a free run covers 3 CSVs at a time, and the Merge step has the same limit on the converted files; Gridhand Pro is USD 49 once. Download Gridhand · Pricing

Questions

Can Gridhand merge CSV files directly? Not in one step: Convert makes .xlsx files from the CSVs and Merge stacks those. Convert can write the result back to CSV.

Do the CSVs need the same columns? In Gridhand, no. Columns are matched by header text and extra columns are kept. With awk or cat they must match.

Does the result come out as CSV or XLSX? Merge writes .xlsx. Convert’s “XLSX to CSV” mode writes one CSV per sheet, so a stacked single sheet becomes one CSV.

How do I keep the header only once in Terminal? Use awk 'FNR==1 && NR!=1 {next} {print}' *.csv > ../merged.csv, or write the header with head and append the rest with tail -n +2.

Microsoft and Excel are trademarks of the Microsoft group of companies. Gridhand is made by Kayabyte and is not affiliated with or endorsed by Microsoft.