Automate importing of TXT files into Excel.

stereoqt

New Member
Joined
Jan 27, 2020
Messages
10
Office Version
  1. 2019
Platform
  1. Windows
Good night! I'd like your help with the following problem. I need to import text files that are inside several folders on multiple Excel sheets. The file structure is as follows:
E:\Users
E:\Users\(user_name1)\(item_name1).txt
E:\Users\(user_name1)\(item_name2).txt
E:\Users\(user_name1)\(item_name3).txt
...
E:\Users\(user_name2)\(item_name1).txt
E:\Users\(user_name2)\(item_name2).txt
E:\Users\(user_name2)\(item_name3).txt
E:\Users\(user_name2)\(item_name4).txt
E:\Users\(user_name2)\(item_name5).txt
...
E:\Users\(user_name3)\(item_name1).txt
E:\Users\(user_name3)\(item_name2).txt
...
*All item names are different, there are no duplicates.

- The structure of txt files is super simple:
(X) item.
X equals the number of items.

- Each (user_name) must be in its own Excel sheet.

I have achieved this using Power Query (Import from folder), the problem is that I must do it MANUALLY, one by one. I have almost 200 user names (with 50-600 txt files in their respective folders), so this would take me A LOT OF TIME.
Is there any way to automate this process?


Example:

Libro1
ABCD
1Source.NameColumn1Column2
2record_1.txt0items
3record_2.txt0items
4record_3.txt1items
5record_4.txt0items
6record_5.txt1items
7
example_1
 
Last edited:

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
There are a bunch of similar threads here.

Here are a few:
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,384
Members
448,956
Latest member
JPav

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top