How to Copy File Names into Excel: A Step-by-Step Guide

Need a list of file names from a folder? Whether you’re organizing documents, creating an inventory, managing project files, or preparing a report, learning how to copy file names into Excel can save you a lot of time compared to typing each name manually.

Fortunately, Windows offers several easy ways to generate a list of file names. You can use built-in tools like Command Prompt and PowerShell, or simply copy file names directly from File Explorer. Once you have the list, you can paste it into Microsoft Excel for sorting, filtering, or further analysis.

In this comprehensive guide, you’ll learn multiple methods to copy file names into Excel, along with tips, troubleshooting advice, and answers to common questions.


Why Copy File Names into Excel?

Creating a spreadsheet of file names has many practical uses.

Common reasons include:

  • Build a document inventory
  • Track project files
  • Create file catalogs
  • Audit folders
  • Organize media collections
  • Share file lists with colleagues
  • Prepare reports

Excel also makes it easy to sort, filter, and search large file lists.


What You’ll Need

Before you begin, make sure you have:

Requirement Purpose
Windows PC Access your files
Microsoft Excel Store and organize file names
Folder containing files Source of file names
Administrator access (optional) Required for some folders

Method 1: Copy File Names Using File Explorer

This is the quickest option when you only need the file names.

Step 1: Open the Folder

Launch File Explorer.

Navigate to the folder containing your files.


Step 2: Select the Files

Choose one of the following:

  • Press Ctrl + A to select all files.
  • Hold Ctrl while clicking to select specific files.

Step 3: Copy the File Names

Hold the Shift key.

Right-click one of the selected files.

Depending on your version of Windows, choose Copy as path.

This copies the full file paths to your clipboard.


Step 4: Paste into Excel

Open Excel.

Click the first cell where you want the list to begin.

Press:

Ctrl + V

Each selected file appears on its own row.

If you only want the file names, you can use Excel formulas such as TEXTAFTER (Microsoft 365) or MID, RIGHT, and FIND (older versions) to remove the folder path.


Method 2: Use Command Prompt

This method quickly creates a list of all file names in a folder.

Step 1: Open the Folder

Navigate to your folder.

Click the address bar.

Type:

cmd

Press Enter.

Command Prompt opens in that folder.


Step 2: Run the Directory Command

Type:

dir /b

Then press Enter.

The /b switch displays only the file and folder names.


Step 3: Save the Output

To save the list to a text file, run:

dir /b > filenames.txt

A file named filenames.txt appears in the current folder.


Step 4: Import into Excel

Open the text file.

Copy its contents.

Paste them into Excel.

Each file name appears on a separate row.


Method 3: Use PowerShell

PowerShell provides more flexibility and can include additional details such as file size or modification date.

Step 1: Open PowerShell

Right-click inside the folder while holding Shift.

Choose:

Open in Terminal (or Open PowerShell window here, depending on your Windows version).


Step 2: List File Names

Run:

Get-ChildItem -File | Select-Object -ExpandProperty Name

This displays only the file names.


Step 3: Export to CSV

To create a CSV file that opens directly in Excel, use:

Get-ChildItem -File |
Select-Object Name |
Export-Csv filenames.csv -NoTypeInformation

Open filenames.csv in Excel.


Method 4: Use Excel’s Get Data Feature

If you use Microsoft Excel 2016 or later, Power Query makes importing folder contents easy.

Step 1

Open Excel.


Step 2

Select:

Data → Get Data → From File → From Folder


Step 3

Browse to your folder.

Click:

Open


Step 4

Excel displays a preview of the files.

Choose:

Load

Excel imports information such as:

  • File name
  • Extension
  • Folder path
  • Date modified
  • File size

This method is especially useful because you can refresh the query later if the folder contents change.


Method 5: Drag and Drop into Excel

For a small number of files, you can simply drag them into an Excel worksheet.

Depending on your version of Excel and Windows, this may insert hyperlinks rather than plain file names. If you only need the names, one of the previous methods is generally more reliable.


How to Remove Folder Paths

If you pasted full paths, you can extract only the file names.

Microsoft 365

If the full path is in cell A2:

=TEXTAFTER(A2,"\",-1)

Older Versions of Excel

Use a combination of RIGHT, LEN, FIND, or MID functions to isolate the text after the last backslash.


How to Include Additional File Information

You may also want to include:

  • File size
  • File type
  • Date created
  • Date modified
  • Folder location

PowerShell and Excel’s Get Data feature make it easy to import these details into separate columns.


Common Problems and Solutions

File Names Don’t Paste Correctly

Try:

  • Pasting into Notepad first to remove formatting.
  • Using Paste Special → Text in Excel.
  • Saving the list as a text or CSV file before importing.

Folder Paths Are Included

Use Excel formulas like TEXTAFTER or Power Query transformations to extract only the file names.


Missing Files

Possible causes include:

  • Hidden files
  • System files
  • Permission restrictions
  • Filtering options in File Explorer

Check your folder settings if expected files are missing.


Tips for Better Organization

After importing file names into Excel:

  • Convert the list into an Excel Table.
  • Add columns for comments or categories.
  • Sort files alphabetically.
  • Filter by file extension.
  • Highlight duplicates using Conditional Formatting.
  • Save the workbook for future updates.

Best Method Comparison

Method Ease of Use Best For
File Explorer Easy Small file lists
Command Prompt Easy Quick text lists
PowerShell Medium Advanced exports
Excel Get Data Easy Dynamic folder inventories
Drag and Drop Very Easy A few files

Frequently Asked Questions

Can I copy only file names without the full path?

Yes. Using Command Prompt (dir /b), PowerShell, or Excel’s Get Data feature returns file names without the full folder path.


Can Excel automatically update when files are added?

Yes. If you import the folder using Data → Get Data → From Folder, you can refresh the query to display newly added or removed files.


Can I include files in subfolders?

Yes. PowerShell and Power Query can include subfolders with the appropriate options or commands.


Does this work on Windows 11?

Yes. All of the methods described in this guide work on Windows 11. Most also work on Windows 10, though some menu names may differ slightly.


Which method is fastest?

For most users, Command Prompt (dir /b) is the quickest way to create a simple list of file names. If you need additional details or automatic updates, Excel’s Get Data feature is often the best choice.


Conclusion

Knowing how to copy file names into Excel can save you significant time when managing folders with dozens or even thousands of files. Whether you use File Explorer, Command Prompt, PowerShell, or Excel’s built-in Power Query tools, each method provides an efficient way to create an organized file list.

For one-time tasks, the dir /b command or Copy as path option works well. If you regularly maintain file inventories, Excel’s Get Data feature offers a more powerful, refreshable solution. Choose the method that best matches your workflow, and you’ll be able to organize your files with far less effort.


Summary

Key Takeaways

  • You can copy file names into Excel using File Explorer, Command Prompt, PowerShell, or Excel’s Get Data feature.
  • The dir /b command quickly generates a list of file names only.
  • PowerShell can export file names and additional metadata to a CSV file.
  • Excel’s Get Data → From Folder creates a refreshable file inventory.
  • Use Excel formulas such as TEXTAFTER to remove folder paths when needed.
  • Organize your imported list with tables, sorting, filtering, and conditional formatting for easier file management.