Get folder / file list into Word or Excel

How to get a list of files in a folder into Microsoft Word.

As long as there have been word processors, we’ve seen the question of how to get a list of files into a document. It should be simple bit it isn’t. Here’s how …

You could write or get a Word macro to do the job but that’s a lot of work and not necessary.

It’s better to find a third-party utility to do the job. Most utilities offer to print the list, but we’re looking for one with a ‘copy to clipboard’ option so you can paste the results into Word or Excel. ‘Save to disk’ is OK but requires an extra few steps that the clipboard option avoids. It’s best if the list is configurable and in a table.

Microsoft’s “solution” is a batch file which takes the DOS dir command output and redirects it to a printer port. Seriously … that’s Redmond’s only solution even for Windows 7! Forget it.

There are many folder listing utilities out there; some readers might have their favorite.

We looked at many and discarded most for one reason or another. Many had no ‘clipboard’ option while others provided few formatting options. Some others had great looking formatting but not a plain table listing that could be pasted into Word or Excel for a user to do their own formatting. A few would not work on, now more common, 64-bit Windows.

Our choice came down to Directory List and Print which has plenty of options with a preview window so you can see how your choices affect the result. In this example we’ve chosen the path in a separate column plus the file size.

Directory list and print - Selection pane.jpg image from Get folder / file list into Word or Excel at Office-Watch.com

The grayed selections are only available to registered users – US$20 or €15. The list can also be manually edited in the preview pane.

You can print the list or export to Word or Excel documents however most useful is the explicit copy to clipboard option on the Output tab.

Directory list and print - Output pane.jpg image from Get folder / file list into Word or Excel at Office-Watch.com

Click on ‘Copy to clipboard’ then paste into Word or Excel.

In Word, the list will appear with a paragraph for each file and tabs to separate the columns. Use the ‘Show All’ button to see the formatting marks.

Directory list and print - Word raw output.jpg image from Get folder / file list into Word or Excel at Office-Watch.com

If you wish to make a table list, select the entire pasted list and choose Insert | Table | ‘Convert text to table’. With a table you can sort and rearrange the columns.

In Excel it’s easier. Excel sees the incoming tab separated content and puts it into individual cells automatically. It also strips the leading spaces from the numbers.

To make some changes, like reformatting the date or file size fields, paste into Excel and use it to make the changes you want eg commas in file size numbers. Then copy the results from Excel into whatever program you like.

Directory List and Print isn’t perfect but it’s the closest solution we’ve found. It’s a pity the program can’t handle network paths, you have to map a drive letter to get a list from a network share.



Reader Denise S. suggest a variant on the Microsoft solution.  Open a ‘DOS’ command box and redirect the folder contents list to a file  eg:

dir > file.txt

 

Then open the file and copy the contents.  An alternative is to do a DIR then select the output on the screen, copy and paste it into the place you want.

 

This works but you don’t get the flexibility of selecting columns, including sub-folders etc that a separate tool provides.  It’s worth keeping the ‘DOS box’ options in mind as a fallback position.