Export filenames to excel

In this short post, I’m going to show you how to easily copy all filenames in a Window folder to Microsoft Excel.

First a caveat, the main limitation of the method I’m going to show you, is that you cannot copy filenames in subfolders. If you want to learn how to how to copy filenames in subfolders, check out the how to easily copy all filenames in a folder to Excel using CMD post.

Let’s jump right into it.

Step 1: Open Excel

Open up excel and then navigate to the folder that contains the files.

Step 1: Open Excel

Step 2: Navigate to Folder and Select All the Files

Navigate to the folder that contains the files.  In the folder that contains the files, select all the files in the folder. You can use the shortcut keys, Ctrl + a.

Step 2: Navigate to Folder and Select All the Files

Step 3: Hold Shift Key and Right Click

Now, holding the Shift key, hover over your selection and right click. Don’t let go of the Shift key before you right click.

Step 3: Hold Shift Key and Right Click

Step 4: Click Copy as Path                

In the window that pops up, click copy as path. This copies the file path of all the files to the Clipboard.

Step 4: Click Copy as Path

Step 5: Paste Filepaths in Excel

Navigate to Excel, I’m using ALT and Tab key, and paste the file paths.

Step 5: Paste Filepaths in Excel

Step 6: Use Replace Function in Excel

We are going to remove the folder path using replace function in excel and we’ll have the filenames.

So double click on one of the cells, select and copy the folder path. Click on Find and Select, scroll down to replace. Click on replace and paste the folderpath. Then click on replace all.

Step 6: Use Replace Function in Excel

Close the Find and Select dialog. Save your excel document and you have successfully copied all the file names in a folder into an excel document.

That’s it for this post, if you want to learn how to also copy the filenames into text check out this post on how to copy file names in windows explorer to text.

And here’s a short how-to video:

How do I copy a list of file names into Excel?

If this is the same question popping in your mind, then you are at the right place.

Also Read: How to Enable Text to Speech On Windows 10.

From the last 2-3 years, I have started backing up my computer files to some external hard drives. To prevent data loss.

And till now I have filled 4-5 hard drives of data.

But it’s really difficult to remember which files are present in which hard drive.

So I started exporting all files names to excel files & keep a record of it.

But it was hell time-consuming. And then I got to know about this trick method of copying filenames from folder in windows explorer.

Let see How it works…

This method of creating a list of the contents of a folder as text has helped me a lot in saving my time. Whether they are too long, short or one word it works with all.

Moreover, you can also create a directory of files present in a folder.

So let’s get started.

1. Open Windows Explorer

Open Windows Explorer and navigate to your favorite folder for which you want to create a list of filenames as text.

Open Windows Explorer

2. Copy File Names as Text from folder

Now select only those files for which you want to copy file names into excel from the folder.

Copy File Names as Text from folder

Now, Press Shift key + Right Click on it. And then select Copy as path Option.

And you have successfully copied files as text and also its location with the file extension.

3. Export Filenames to Excel

Now it turns to export filenames to excel file in windows 10. So, Open your Excel sheet and Press Ctrl+V to paste it properly.

Export Filenames to Excel

And you can also copy filenames to Notepad as text using this technique.

Some FAQs

How do I copy file names into Excel Windows 10?

To copy file names into excel in Windows 10, go to the desired folder, select all files, hold the Shift key & right-click and then click on the Copy as Path option.

How do I copy a list of filenames into Excel?

If you want to copy a list of filenames into excel, just select all the files, hold shift + right-click & then choose Copy as Path option.

How can I copy a list of file names as text?

To copy the list of file names as text, Select the full list > Hold Shift-key + Right-click > Copy as Path and then paste it into a notepad file as text.

How do I copy the names of all files in a folder Windows 10?

Copying the names of all files in a folder using Windows 10 is pretty easy, just press Ctrl+A to select the files, right-click on them while holding the Shift key, and then select the “Copy as Path” from the options.

That’s it for now…

Conclusion

So that’s how you can easily get a list of all files in a folder and subfolders into excel. And you can also follow the same method for Windows 7/8.

Check out the next post on how to copy filenames to excel using cmd.

Feel free to share your thoughts and also tell us if you know any better way to Export or Copy File Names Into Excel From Folder in Windows 10.

If you liked this post, Don’t forget to share this post.

  • Редакция Кодкампа

17 авг. 2022 г.
читать 2 мин


Часто вас может заинтересовать экспорт фрейма данных pandas в Excel. К счастью, это легко сделать с помощью функции pandas to_excel() .

Чтобы использовать эту функцию, вам нужно сначала установить openpyxl , чтобы вы могли записывать файлы в Excel:

pip install openpyxl

В этом руководстве будет объяснено несколько примеров использования этой функции со следующим фреймом данных:

import pandas as pd

#create DataFrame
df = pd.DataFrame({'points': [25, 12, 15, 14, 19],
 'assists': [5, 7, 7, 9, 12],
 'rebounds': [11, 8, 10, 6, 6]}) 

#view DataFrame
df

 points assists rebounds
0 25 5 11
1 12 7 8
2 15 7 10
3 14 9 6
4 19 12 6

Пример 1: базовый экспорт

В следующем коде показано, как экспортировать DataFrame по определенному пути к файлу и сохранить его как mydata.xlsx :

df.to_excel (r'C:UsersZachDesktopmydata.xlsx')

Вот как выглядит фактический файл Excel:

Пример 2: Экспорт без индекса

В следующем коде показано, как экспортировать DataFrame в определенный путь к файлу и удалить столбец индекса:

df.to_excel (r'C:UsersZachDesktopmydata.xlsx', index= False )

Вот как выглядит фактический файл Excel:

Пример 3: Экспорт без индекса и заголовка

В следующем коде показано, как экспортировать DataFrame в определенный путь к файлу и удалить столбец индекса и строку заголовка:

df.to_excel (r'C:UsersZachDesktopmydata.xlsx', index= False, header= False )

Вот как выглядит фактический файл Excel:

Пример 4: Экспорт и имя листа

В следующем коде показано, как экспортировать DataFrame в определенный путь к файлу и назвать рабочий лист Excel:

df.to_excel (r'C:UsersZachDesktopmydata.xlsx', sheet_name='this_data')

Вот как выглядит фактический файл Excel:

Полную документацию по функции to_excel() можно найти здесь .

Maintaining an Excel spreadsheet of computer files can help you keep track of important business documents or images. Unfortunately, Microsoft Excel doesn’t include a one-step method for importing a file list from Windows Explorer, but Windows 7 offers an easy workaround. Using the Command Prompt, you can tell Windows to output a text document containing a directory list. This text document can then be imported into Excel and modified just like any other spreadsheet.

  1. Press «Win-E» to open Windows Explorer and locate the folder for which you need a file list.

  2. Hold the «Shift» key, right-click the folder and select «Open Command Window Here.» This only works with folders, not libraries. Libraries point to a specific folder, so select the folder located under the library icon. If the library points to a drive, right-click the drive letter from the folder tree.

  3. Type «dir /b > dirlist.txt» without quotes and press «Enter.» This creates a list containing file names only. To include file sizes and dates, type «dir > dirlist.txt» instead. To also include files in sub-directories, type «dir /b /s > dirlist.txt» to create a list of files with the full directory structure name, such as «C:foldersubdirectoryfile.txt.»

  4. Open Microsoft Excel and press «Ctrl-O» to bring up the Open dialog window.

  5. Navigate into the folder containing the files. Click the file type drop-down menu and select «Text Files (.prn,.txt,*.cvs).» Double-click «dirlist.txt» to open it.

  6. Click «Finish» in the Text Import Wizard window to use the default options and import the directory list into Excel.

See all How-To Articles

This tutorial will demonstrate how to export the folder and subfolder structure to Excel.

ImportFolder Intro

Import a list of File Names and Folder Locations with Power Query

Using VBA to list the files in a folder is a great solution in Excel however now Excel has introduced a way to do this using Power Query where VBA is not required.

  1. In the Ribbon, select Data > Get Data > From Folder.

ImportFolder Ribbon

  1. Browse to the folder that contains the files and sub-folders you wish to obtain a list of, and click Open.

ImportFolder Open

  1. When the list of files is shown, select Transform Data.

ImportFolder Transform

This opens the Power Query editor.

ImportFolder PowerQuery

  1. Using the Power Query editor, we can remove columns to import into Excel as well as merging columns together if we wish.
    To remove the selected column, In the Ribbon, select Home > Remove Columns > Remove Columns.

ImportFolder RemoveColumns

  1. To remove more than one column at a time, in the Ribbon, select Home > Choose Columns > Choose Columns.

ImportFolder Choose Columns

  1. Deselect the columns not required, and click OK.

ImportFolder Load

  1. In the Ribbon, select Home > Close & Load to load the data into Excel.

ImportFolder Loaded data

  1. The data is returned to Excel as a data table which is connected to the folder it is referring to. This means that if we add another file to any of the folders selected, and then click Refresh, the number of files will be updated.

ImportFolder Refresh

  1. To return to Power Query in order to edit the information shown, in the Ribbon, select Query > Edit.

ImportFolder PowerQuery Edit

  1. In the Ribbon, select Home > Query > Manage Columns > Manage Columns and then add a few more columns back into the query.

ImportFolder-PowerQuery AddColumns

  1. A the top of each column is the ability to filter. In the Extension column, we are going to filter by .xlsx to only show Excel Files.
    Click Select All to deselect all the Extensions, and then select the .xlsx extension only.

ImportFolder SelectExcelOnly

  1. Click OK to apply the filter.

ImportFolder FilterXL

We can also filter by Attribute – in the case below, by size.

ImportFolder SelectSizeOnly

  1. If we have applied any steps to the query that we wish to remove, we can delete them from the Applied Steps list in the Query Settings on the right hand side of the screen.

ImportFolder ShowSteps

  1. Select the step you wish to remove.

ImportFolder RemoveStep

If you remove anything but the last step, you will receive a warning. However, you may delete the steps in the order you applied them without getting a warning.

ImportFolder Warning

  1. Once you have adjusted your data, click Close and Load to load the data into Excel.

Перейти к содержанию

На чтение 2 мин Опубликовано 21.06.2015

  • Импорт
  • Экспорт

Эта статья описывает, как импортировать или экспортировать текстовые файлы. Текстовые файлы могут быть разделены запятыми (.csv) или знаками табуляции (.txt).

Импорт

Чтобы импортировать текстовые файлы, следуйте нашей инструкции:

  1. На вкладке File (Файл) кликните Open (Открыть).
  2. Из выпадающего списка выберите Text Files (Текстовые файлы).Импорт и экспорт текста в Excel
  3. Чтобы импортировать файл …
    • CSV, выберите документ с расширением .csv и нажмите кнопку Open (Открыть). Это всё.
    • TXT, выберите документ с расширением .txt и кликните по Open (Открыть). Excel запустит Text Import Wizard (Мастер текстов (импорт)).
  4. Выберите Delimited (С разделителями) и нажмите Next (Далее).Импорт и экспорт текста в Excel
  5. Уберите все галочки кроме той, что напротив Tab (Знак табуляции) и кликните Next (Далее).Импорт и экспорт текста в Excel
  6. Нажмите Finish (Готово).Импорт и экспорт текста в Excel

Результат:

Импорт и экспорт текста в Excel

Экспорт

Чтобы экспортировать книгу Excel в текстовый файл, сделайте следующее:

  1. Откройте документ Excel.
  2. На вкладке File (Файл) нажмите Save As (Сохранить как).
  3. Из выпадающего списка выберите Text (Tab delimited) (Текстовые файлы (с разделителями табуляции)) или CSV (Comma delimited) (CSV (разделители – запятые)).Импорт и экспорт текста в Excel
  4. Нажмите Save (Сохранить).

Результат: CSV файл (разделенный запятыми) и TXT файл (разделённый знаками табуляции).

Импорт и экспорт текста в Excel Импорт и экспорт текста в Excel

Оцените качество статьи. Нам важно ваше мнение:

Like this post? Please share to your friends:
  • Exporting datagridview to excel
  • Exporting data to excel php
  • Exporting data from sql server to excel
  • Export word to text
  • Export vba from excel