Please Note: This article is written for users of the following Microsoft Excel versions: 2007 and 2010. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Importing Many Files Into Excel.

Importing Many Files Into Excel

by Allen Wyatt
(last updated June 17, 2015)


Andrew asked if there is a way to import many different files into Excel, all using the same import specifications. For instance, when you choose to import a comma-delimited text file, Excel's import filter asks you a series of questions about how the import should be done. If you are importing a single file, this is not a problem. If you have fifty or sixty files to import, answering the questions over and over again can get very tedious very quickly.

The short answer is that there is no way to do a "mass import" in Excel. Some questions asked by the import filter simply need to be asked for each file. The only way around this is to create your own "import" process using a macro. The macro can either open the source file itself, or it can answer the Import Wizard questions, as it sees fit.

Of course, writing such a macro can be a daunting exercise. It is beyond the scope of ExcelTips to attempt such a macro, particularly since the process to be followed during the import can vary so much from one type of input file to another.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12080) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: Importing Many Files Into Excel.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...


Creating a Directory

Need to create a directory from within a macro? You can do it using a single command line, as detailed in this tip.

Discover More

Creating Custom Labels

There is a whole passel of labels pre-defined in Word. You are not limited to this passel, however; Word allows you to define ...

Discover More

Using Unique Document Serial Numbers

If you need to include serial numbers in your printed matter (labels, letters, documents, etc.), the best way is through the ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Getting Rid of Empty Rows after Importing

Import data into a worksheet (or paste it there) and you may find that you end up with a group of blank cells you need to get ...

Discover More

Importing Multiple Files to a Single Workbook

If you use Excel to work with data exported from another program, you might be interested in a way to import a large number ...

Discover More

Loading Unwanted Files at Startup

Imagine how painful it would be if every time you started Excel it tried to load all the files in your root directory? That ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 3 - 2?

2015-06-17 13:40:42

Matthew McCormack

This web page has a nice VBA script that can be easily adapted,

2015-06-17 13:31:29

Donald Parish

The Power Query add-in is how I would solve this today. One of the choices is to import all the text files in a folder into a single table. Can also with Excel workbooks with some modification of the Power Query Language (M) code.

2015-06-17 12:43:08


For things like comma delimited files, I find it much easier to concatenate them in DOS (well, the command window).

The expression

For %g in (*.txt) do type %g >> all.txt

will give you a file called all.txt that contains all the content of the other files.

I don't know if there are limits to how big a file excel can import at once, but I haven't run into a problem doing this.

2015-06-17 10:24:24


It's definitely possible to import multiple files. I found a good way to do it is record a macro for one file and assuming the rest are in a similar format, use the same code to import the other files which are all semi colon delimited. I used some additional code from another example on this site to trim all the data to clean up any leading or trailing blank spaces. If you had files in different formats I could definitely see the problem with trying to code it but if the files are in the same layout type it's not impossible. In my case I am able to import about 7 semi colon delimited text files in to Excel then export it out to a preformatted Excel report.

2015-06-17 08:15:25


Oops, small editing typo, but ChDir should be the same as the one in the FileName obviously.

2015-06-17 08:13:11


Actually it isn't that hard. You can use the macro recorder to see what the code looks like when importing a file. I just imported a .txt and here are the results:

Sub Macro1()
' Macro1 Macro

Application.WindowState = xlNormal
ChDir "D:safont-gregoriDesktop"
Workbooks.OpenText Filename:="D:meDesktoptest.txt", _
Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 1), _
End Sub

With some patience, you can see what variable does what. Also, you should add a couples of lines saying that you want to copy Sheet(1) to a proper Workbook (since when importing a file, Excel doesn't create a new .xlsx to it, it modifies the actual file).

Once the code for one file is ready, you just need to loop through all files in a folder, which isn't particularly hard.

2015-06-17 08:09:28


You can create a sheet that specifies file name, folder, cell ranges to be imported and cell ranges where they should be pasted.

Then you can loop through each file and perform the copy paste using the indicated cells.

I inherited this system from a coworker and it works very well.
Not sure whether it's the most efficient but it's very customizable as each file can have different range sizes.

2012-09-15 08:16:50


Try an excel add on called ASAP utilities. That should do the trick.

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.