List of files in Excel (easy way, no VBA macros or formulas)

In this post, I’ll answer a question about how to create a list of files in a folder (and any subfolders) in Excel. For this illustration, we’ll use Power Query instead of VBA/Macros.

Objective

Before we jump into the details, let’s look at the objective. We want to create a list of files in a folder (as well as any subfolders). We want this list in Excel. We do not want to use VBA code or macros. We do have a fairly modern version of Excel for Windows which includes Power Query.

We basically have a folder with some files and a subfolder, like this:

And we want something like this in Excel:

Good news … we can create this with only a couple of mouse clicks 🙂

How To – Windows

First, click Data > Get Data > From File > From Folder.

In the resulting Browse dialog, simply browse to the desired folder and click Open.

You’ll then see a preview screen with a list of the files in that folder and any subfolders, like this:

Next, click the down arrow on the Load button and select Load To. In the resulting Import Data dialog, select Table and either a new or existing worksheet as desired.

Click OK and bam…

And that is what we call mission success 🙂

As a note, if you wanted to remove any columns or rows, you can click on Transform Data instead of Load. In the resulting Power Query window, you can easily delete columns you don’t need (Home > Remove Columns). You can also remove any rows you don’t need by using the filter buttons on the columns.

How To – Excel for Mac

If you are on Excel for Mac, and Power Query doesn’t have the From Folder option at the time you read this, my friend Rod showed me a great option for pasting the full path and file name into Excel for Mac.

Step 1 – Open Finder and Select Files

Open Finder and select the files, like this:

Step 2 – Copy

Now, do one of these two Copy commands

  • Command+C – if you want to copy the file name only (not the file path)
  • Command+Option+C – if you want to copy the file name and path

Step 3 – Paste

Toggle over to Excel and select a cell. Now, use one of these two Paste commands:

  • Command+V – if you copied the file name only
  • Paste Special > Text – if you copied the file name and path

Thanks Rod!

Conclusion

Hope this helps! And if you have any other Power Query or Excel for Mac tips, please share by posting a comment below … thanks!

Posted in ,

Jeff Lenning

I love sharing the things I've learned about Excel, and I built Excel University to help me do that. My motto is: Learn Excel. Work Faster.

Excel is not what it used to be.

You need the Excel Proficiency Roadmap now. Includes 6 steps for a successful journey, 3 things to avoid, and weekly Excel tips.

Want to learn Excel?

Our training programs start at $29 and will help you learn Excel quickly.

6 Comments

  1. Valerie on September 28, 2022 at 8:52 am

    This is awesome!! You don’t know how many times I have needed to do this! Thank you!

  2. Lesley Williams on September 28, 2022 at 11:24 am

    I love this too. I thought it would be more useful if there were hyperlinks to the files. In Power Query I added the prefix file:/// to the Folder Path column and then made a new column [Folder Path]&”\”&[Name] and called it Full Path. After loading it to a table I made a new column in Excel outside the table and added the hyperlink formula pointing to my Full Path column with the Friendly Name “Go to File”. It worked but seems a bit clunky. I’m sure someone will have a better way of doing this. I saw an article that said Power Query doesn’t have a Hyperlink data type YET, implying it is coming?

  3. Kathy on September 28, 2022 at 11:25 am

    Great tip! You always make things look so easy!

  4. Willie Stevenson on September 28, 2022 at 11:45 am

    Jeff, I use this technique to catalogue my thumb drives. If I need to find an old file I’ve archived on one of my many memory sticks I just need to open one workbook and search. Each drive’s name and directory listing is on a separate sheet.

  5. Cyndi Hagan on September 28, 2022 at 1:02 pm

    This tip showed up at just the right time as I needed this today. Thank you!!

  6. John Zak on September 28, 2022 at 2:41 pm

    This is awesome! So easy to create and is perfect when you add the HYPERLINK Function to it. Thank you.

Leave a Comment