Important many txt files into single sheet

mroseto

Board Regular
Joined
Jul 18, 2002
Messages
203
Hello,

I currently have 99 txt files that I would like to import in 1 single excel sheet. As you can imagine importing copying/pasting is brutally tedious so any help with this would be greatly appreciated. If it would help the cause at all, I can export the information as .xls.

Thanks in advance

Mike
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Tips and Tricks -batch file to merge multiple .txt .csv files.

Open Notepad Start => All programs => Accessories => Notepad
type in: copy *.txt merged.txt
i.e., copy all text files into a file called merged.txt

click File => SaveAs
Name the file giving it a .bat extesion, i.e, "mergefiles.bat"
Set File type to All Files
Save the file to the same folder as the text files.

Navigate to the folder through MyComputer.
Double click on the batch file to run.

NB all text files in the folder will be merged intp the file called merged.txt

Now you only have one file to import into Excel.
 
Upvote 0
That is fantastic.

I never knew such a function existed. I can't thank you enough this has saved me hours of time.

Mike
 
Upvote 0
translated in VBA:

Code:
Sub samen()
  Open "E:\samenvoeg_tekstbestanden.bat" For Output As #1
    Print #1, "copy *.txt samen.txt"
  Close
  Shell "E:\samenvoeg_tekstbestanden.bat"
End Sub
 
Upvote 0
This is fantastic!

Does anyone know if there's a way to ask the user for the folder in which all the data is placed?

Thanks as always,
Court
 
Upvote 0

Forum statistics

Threads
1,215,945
Messages
6,127,861
Members
449,411
Latest member
adunn_23

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