PDA

View Full Version : multiple text file import in single excel sheet



ashie.joshi
09-04-2011, 04:43 AM
I have many text files in a folder C:\test and I want to gather/import these files' names and data (only single-line data) into C:\test\text.xlsx in different columns with header (top row header and header can be anything).

Also, I need both the files' date and time in two separate columns in the generated Excel file.

Thanks in advance

parttime_guy
09-04-2011, 06:06 PM
Get to the MS-DOS prompt or the Windows command line.
Navigate to the directory you wish to print the contents of. If you're new to the command line, familiarize yourself with the cd command and the dir command.
Once in the directory you wish to print the contents of, type one of the below commands.

dir > print.txt
or
dir > print.xls

The above command will take the list of all the files and all of the information about the files, including size, modified date, etc., and send that output to the print.txt file in the current directory.

dir /b > print.txt
or
dir /b > print.xls

This command would print only the file names and not the file information of the files in the current directory.

dir /s /b > print.txt
or
dir /s /b > print.xls

This command would print only the file names of the files in the current directory and any other files in the directories in the current directory.

Hope this helps
http://www.computerhope.com/issues/ch000772.htm

ashie.joshi
09-04-2011, 06:48 PM
Hi,
Thanks for your reply,
But I need vb code for this.

parttime_guy
09-05-2011, 07:17 PM
Try this

http://www.vbaexpress.com/kb/getarticle.php?kb_id=837

mancubus
09-05-2011, 11:07 PM
if you are using office2007 or higher:
http://www.vbaexpress.com/kb/getarticle.php?kb_id=1042

ashie.joshi
09-06-2011, 02:20 AM
Thank u so much

ashie.joshi
01-22-2012, 09:25 AM
I want to add new thread pls help me