Extract File Name as Text from Stored Files in a Folder
๐ Topic: How to Extract
File Name as Text from Stored Files in a Folder (Using Excel)
๐ฏ Objective:
Extract only the file names (without path) from a
list of full file paths copied from a folder, using Excel’s Flash Fill.
๐งญ Step-by-Step Process
Flow
๐น Step 1: Select All
Files in a Folder
- Open
the folder where your files are stored (e.g., PDFs, Word, Excel files).
- Press Ctrl
+ A to select all files.
๐น Step 2: Copy File Paths
- While
all files are selected, hold the Shift key, then:
- Right-click
anywhere on the selection.
- Click
on Copy as path
๐ This copies the full file path for each file, like:
arduino
CopyEdit
"C:\Users\YourName\Documents\Reports\Report1.pdf"
๐น Step 3: Paste into
Excel
- Open
any Excel workbook.
- Click
on Cell A1 (or wherever you want to paste).
- Press Ctrl
+ V to paste the list. You will see full file paths like:
arduino
CopyEdit
"C:\Users\YourName\Documents\Reports\Report1.pdf"
"C:\Users\YourName\Documents\Reports\Report2.pdf"
๐น Step 4: Use Flash Fill
to Extract File Names
- In the
next column (e.g., B1), type the file name manually for the first
row:
CopyEdit
Report1.pdf
- Go to B2,
start typing the next filename or press Ctrl + E to activate Flash
Fill.
- Excel
will auto-extract the file names from the full path in column A.
- Your
column B will now look like this:
python-repl
CopyEdit
Report1.pdf
Report2.pdf
Report3.pdf
...
✅ Done! You now have all
file names extracted as plain text.
๐ก What is Flash Fill?
Flash Fill is an Excel feature that automatically
fills in values based on a pattern you start typing.
๐ How to Enable Flash
Fill (if not working)
- Go to File
→ Options → Advanced
- Scroll
to Editing Options
- Check ✅
Automatically Flash Fill
- Click OK
Or use the shortcut:
➡️
Ctrl + E (manually triggers Flash Fill)
๐งพ Bonus Tip: Remove File
Extensions (Optional)
If you want just the name without extension, like Report1
instead of Report1.pdf:
- In column
C, type:
nginx
CopyEdit
Report1
- Use
Flash Fill again (Ctrl + E).
Excel will auto-detect and remove the extensions from the
filenames.
✅ Summary Workflow:
Step |
Action |
1 |
Select files in folder and Shift + Right-click → Copy
as Path |
2 |
Paste into Excel |
3 |
Use Flash Fill in next column to extract file names |
4 |
(Optional) Use another Flash Fill to remove file
extensions |