2 Methods to Copy the List of All File Names in a Folder into Your Excel Worksheet

Sometimes you will need to list all the file names in a folder in an Excel worksheet. Thus, you can better manage those files. In this article, we will introduce two effective methods to copy the list in a folder.

In an Excel worksheet, you can make a menu of some important files. And you need to copy the list of all the file names into one worksheet. However, when there are hundreds or thousands of files, you will find it hard to do this. In the image below, you can see several files.Example

Now you need to copy the list of all the file names into a worksheet in another Excel file. If you copy and paste them one by one manually, you will certainly spend a lot of time and energy. At this time, you can use the two methods below.

Method 1: Use a New Text Document

Now follow the steps below and see how this method takes effect.

  1. Before you perform this process, make sure that you have shown the file extensions in your computer. Click the button “Start” in your computer.
  2. And then click the button “Control Panel”.Control Panel
  3. In the control panel, click the “Appearance”.
  4. And then click the button “Folder Options”.
  5. After that, choose the option “View” in the “Folder Options” window.
  6. Next uncheck the option “Hide extension for known file types”.
  7. And then click “OK” to save the setting.Uncheck Option

Therefore, you can see all the extensions of files in your computer.

  1. Come back to the folder, create a new text document and give it a new name. We will name it “DataNumen Sales Volume”.
  2. And then open this text file.
  3. After that, input the following characters into this file:

dir> 1.txt

Input Characters

  1. Next save this file and close it.
  2. In this step, change the extension of this file from “.txt” into “.bat”.
  3. After that, you will see a new window pop up. Here you need to click the button “Yes” to confirm this change.Yes
  4. And then double click this file again. Next you will see a new text document with the name “1” in this folder.
  5. Open this new text document in this folder. You will see all the name information in it.
  6. After that, copy the necessary part in this file.Copy Name
  7. And then in the target worksheet, click the small arrow under the button “Paste”.
  8. In the drop-down list, choose the option “Use Text Import Wizard”.Text Import Wizard
  9. Next in the new window, choose the option “Fixed width”.
  10. And then click the button “Next”.Fixed Width
  11. In step 2 of the wizard, move the break line and make sure that the names of those files will be in one cell.
  12. And then also click “Next”.Move Line
  13. In step 3, click “Finish”. Thus, all the information will appear in the worksheet.Result

You can delete the other useless columns in the worksheet. By using this method, you don’t have to copy and paste the names one by one.

Method 2: Define Name

In this part, we will introduce another excellent method.

  1. Click the tab “Formulas” in the ribbon.
  2. And then click the button “Define Name”.
  3. In the “New Name” window, input a name into the first text box. We will also name it “DataNumen_Sales_Volume”.
  4. After that, input this formula into the “Refers to” text box:

=FILES(“C:\Users\Sample\Desktop\Sales Volume\*.*”) &T(NOW())

The path of the folder is “C:\Users\Sample\Desktop\Sales Volume” in this example. You need to change it into your actual folder path.New Name

  1. And then click the button “OK” in the window.
  2. Now input the following formula into one cell in the worksheet:

=IF(ROW(A1)>COUNTA(DataNumen_Sales_Volume),””,INDEX(DataNumen_Sales_Volume,ROW(A1)))

In this formula, you need to change the define name into yours.

  1. After that, click the fill handle of this cell and drag downwards. As you move your mouse, you will also find that all the names will appear in this column.Result
  2. But you may also find that those results are the results of formulas. You still need to copy and paste them as texts.
  3. Next delete the formulas in the worksheet.

Until now, you have gone through all the steps. This method is also very effective for this requirement.

A Comparison of the Two Methods

You can see that both of the two methods are very useful. Here we will compare the two methods in this part.

Comparison

Use a New Text Document

Define Name

Advantages

If you are not familiar with Name and the complex formula in cells, you can use this first method. There are fewer steps in this method. You can finish your tasks quickly by using it.

Disadvantages

Compared with the second methods, there are more steps in this method. You still need to spend a lot of time. The formulas in cells will produce the results that you need. Therefore, you still need to copy and paste them as values.

When you need to input all file names into a worksheet, you will know which method is the most suitable one.

Take Actions Quickly in a Data Disaster

It is unavoidable that you will meet with data disaster. In such an accident, your Excel files will most possibly be damaged. Therefore, you need to take actions quickly. In order to repair corrupt xls data quickly and safely, you can use out excellent Excel repair tool. This tool is able to fix most of the Excel problems.

Author Introduction:

Anna Ma is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair Word doc data error and outlook repair software products. For more information visit www.datanumen.com

8 responses to “2 Methods to Copy the List of All File Names in a Folder into Your Excel Worksheet”

  1. Method 1: the system Win 11 did not allow me to run the .bat file, and after I ran it as an administrator, a window flashed briefly, but the 1.txt file was NOT formed at all. I checked the folder, that new file is nowhere to be found. I noticed afterwards that all the files with the extension .eml, which happened to be in the same folder and were created at different periods in history, had their Date modified time changed to the exact same time (the same moment) when I started the .bat file (??? ). I’ve checked the contents of those files, they don’t seem to have changed. I hope so.

  2. 당신은 너무나 사랑스럽다! 나는 방법1을 사용했고, 덕분에 cmd를 사용하지않고 많은 일을 짧은 시간 안에 해낼 수 있었다.

  3. Excellent goods from you, man. I’ve understand your stuff previous to and you are just extremely great. I really like what you have acquired here, certainly like what you’re saying and the way in which you say it. You make it entertaining and you still take care of to keep it smart. I can not wait to read far more from you. This is really a wonderful site.

Leave a Reply

Your email address will not be published. Required fields are marked *