Excel cannot open a whole folder of text files in one click, but you can bring them all in with a short Power Query routine. Put every file in one folder, then use Data > Get Data > From File > From Folder. Excel lists the files, and you choose Combine & Transform to stack them into one table. The steps below are for Excel on Windows and Mac; menu labels can differ slightly by version and region.
What You'll Need
- Excel 2016 or later (Power Query is built in; in older versions it was an add-in).
- All the text files in a single folder, with no other file types mixed in.
- Each file laid out the same way: same delimiter (comma, tab, or pipe) and the same column order.
- A header row in each file, or a decision to add headers after import.
Step-by-Step
- Collect the files. Move every .txt (or .csv) file into one folder. Delete or move anything that is not a text file, because Power Query will try to read every file it finds.
- Check the layout. Open two or three files in Notepad or TextEdit and confirm they use the same delimiter and the same column order. A file with an extra column will shift the data when combined.
- Start the import. In Excel, go to Data > Get Data > From File > From Folder. On Mac, the path is Data > Get Data (Power Query) > From File > From Folder. If you only see “From Text/CSV,” your version is older; use that command one file at a time instead.
- Point to the folder. Browse to the folder, click Open, then click Combine & Transform in the preview dialog. If you only see a file list, click Transform Data and use the Combine Files command on the Content column.
- Set the delimiter. In the sample file dialog, choose the delimiter your files use (Comma, Tab, Semicolon, or Custom). Confirm the first row is set as headers if your files have them.
- Review the combined query. Power Query opens a preview. Check that column names and types look right. Remove any helper columns you do not need, such as the source file name, or keep it to trace rows back to their file.
- Load to a worksheet. Click Close & Load (or Home > Close & Load > Close & Load To) and choose Table on a new worksheet. Excel writes the combined data to a table.
- Refresh later. When you add or edit files in the folder, right-click the table and choose Refresh. The query re-reads the folder and updates the table.
Common Mistakes
- Mixed delimiters. One file using commas and another using tabs will produce misaligned columns. Standardise before importing.
- Extra files in the folder. A stray .csv, a hidden system file, or a backup copy will be pulled in. Keep the folder clean.
- Different header rows. If one file has headers and another does not, the first data row becomes a header. Fix the source files or remove headers in Power Query.
- Forgetting to promote headers. Without promoting the first row, Excel names columns Column1, Column2, and so on.
- Editing the loaded table directly. Typing into the output table is lost on refresh. Edit the source files or the query instead.
Tips
- Keep the folder path short and avoid special characters; some versions struggle with very long paths.
- Use a dedicated folder per project so a refresh does not pull in unrelated files.
- If your files are .csv, the same From Folder method works and is often cleaner than opening each file.
- Add a custom column with the file name if you need to know which file each row came from.
- For a one-off import of a few files, you can also open each with File > Open and copy the data, but Power Query is faster and repeatable.
Troubleshooting
- “We found extra columns” or misaligned data: the files do not share the same structure. Open the query, check the sample file, and remove or add columns so every file matches.
- Only one file appears: the folder path is wrong or the files are in subfolders. From Folder reads the top level only; move files up or use a different folder.
- Error on refresh: a file was moved, renamed, or locked by another program. Close the file and refresh again.
- Dates or numbers import as text: set the column data type in Power Query (Transform > Data Type) before loading.
- Nothing happens when you click Combine: try Transform Data instead, then use the Combine Files button on the Content column.
Frequently Asked Questions
Can I import text files from different folders at once?
Not with a single From Folder query. Move the files into one folder, or create one query per folder and append the results.
Does this work in Excel for Mac?
Yes, current Excel for Mac includes Power Query with From Folder. The menu wording may differ slightly from Windows.
Will the import update when I add a new file?
Yes, after you refresh the query. The new file is picked up as long as it sits in the same folder and matches the layout.
What if my text files use a delimiter other than comma or tab?
Choose Custom in the delimiter step and type the character, such as a pipe or semicolon.
Can I import only some of the files in a folder?
Yes. In the file list, filter the Name column to the files you want before combining.
Do I need a header row in each file?
Not required, but every file should be consistent. If none have headers, leave the header option off and rename columns in Power Query.