To import file names from a folder into Excel, use the Get Data feature in Excel 365 or Excel 2016 and later to connect to a folder, extract file names, and load them directly into a worksheet—no manual copying or VBA required.
What You'll Need
- Microsoft Excel 2016 or later (including Excel 365)
- A folder containing the files whose names you want to import
- Basic familiarity with Excel’s ribbon interface
Step-by-Step
- Open Excel and create a new blank workbook.
- Go to the Data tab on the ribbon.
- In the Get & Transform Data group, click Get Data → From File → From Folder.
- A dialog box will appear. Click Browse and navigate to the folder containing the files you want to list.
- Select the folder and click OK. Excel will scan the folder and display a preview of all files and subfolders.
- In the preview window, you’ll see columns like Name, Extension, Date modified, Size, and Folder Path. To import only file names, ensure the Name column is selected.
- Click Combine & Load if you want to combine file contents (skip this step if you only want names). Instead, click Load directly to import the file list as-is.
- If you clicked Load, Excel will create a new worksheet with a table containing all file names and metadata. To keep only the file names, right-click any column header except Name, choose Remove, and repeat for all unwanted columns.
- Alternatively, before loading, click Transform Data instead of Load to open Power Query Editor. In Power Query, select only the Name column, right-click any other column, and choose Remove Columns. Then click Close & Load to send the cleaned list to Excel.
- The file names will now appear in a formatted Excel table. You can sort, filter, or format them as needed.
- To update the list later if files are added or removed, right-click the table and choose Refresh. Excel will rescan the folder and update the list automatically.
Common Mistakes
- Choosing From File instead of From Folder: This tries to open a single file, not scan a directory.
- Forgetting to remove unwanted columns: Leaving columns like Extension or Size clutters the output.
- Using Combine & Load when you only want file names: This attempts to merge file contents, which fails if files are different types or empty.
- Not refreshing after adding new files: The list stays static unless you manually refresh.
- Trying to use this method in Excel 2013 or earlier: The From Folder option is not available without Power Query add-in, which is not enabled by default.
Tips
- Use clear, consistent folder names and avoid special characters in file names to prevent import errors.
- If you need to include file paths, keep the Folder Path column—it’s useful for locating files later.
- To import file names from subfolders too, ensure the Subfolders checkbox is checked in the folder selection dialog.
- Save the query as a connection: Go to Data → Queries & Connections, right-click your query, and choose Properties to enable background refresh.
- For repeated use, save the workbook as a template (.xltx) so you can reuse the folder import setup.
Troubleshooting
- No files appear in the preview: Verify the folder path is correct and that you have read access. Check if files are hidden or in a network location with restricted permissions.
- Error: "We couldn't combine the files": This occurs if you clicked Combine & Load by mistake. Close the window and click Load instead.
- File names show as "Error" or blank: This may happen if a file is locked, corrupted, or has an unsupported character in its name. Try moving problematic files out temporarily.
- The From Folder option is missing: You’re using Excel 2013 or earlier. Install the free Power Query add-in from Microsoft’s website, or upgrade to a newer version of Excel.
- The list doesn’t update after refreshing: Ensure the query is set to refresh on open. Go to Data → Queries & Connections, right-click the query → Properties → check Refresh data when opening the file.
Frequently Asked Questions
Can I import file names from multiple folders at once?
Yes—select the parent folder and ensure Subfolders is checked. Excel will recursively scan all subfolders and include file names from each level.
Will this work on a Mac?
Yes, Excel for Mac 2016 and later includes the same Get Data → From Folder functionality under the Data tab.
Can I import only files of a certain type, like .pdf or .jpg?
After loading the file list, filter the Extension column to show only the types you want (e.g., .pdf), then copy the filtered Name column to another sheet.
Is there a way to do this without Power Query?
Only with VBA or manual copying. The From Folder method via Get Data is the only built-in, no-code way in modern Excel.
What if I want the file names in a single column without a table?
After loading, copy the Name column, right-click a destination cell, and choose Paste Values to remove the table formatting and keep plain text.
Does this work with cloud folders like OneDrive or SharePoint?
Yes—as long as the folder is synced to your local machine, Excel treats it like any local folder and can scan its contents.