Home > Software engineering >  Excel in bulk read TXT specified column data
Excel in bulk read TXT specified column data

Time:09-30

I have 1000 TXT, each have 5 column data, I want to make a list of 5 each TXT out as a column in a excel in, don't want to one by one manually import coming again I don't delete columns, how do I by macro? O excelVBA code,

CodePudding user response:

To record your manual operation process and appropriate adjustments will become a macro code automatic operation...

CodePudding user response:

Or the TXT file into the array, recycle out each element of the fifth data written to the excel...

CodePudding user response:

1. Stick a few lines of your. TXT file content, let everyone know your text file content is what kind of format,
So that others may know you is how to define the "five columns data", "the fifth column content" should be separated by what method,
If you have sensitive content or privacy content, can replace with other text content (such as with XXXX, * * * * * *, etc.),

2. Your 1000. TXT file, concentrated in a folder?

3. Import content, documents for order?
If you have the requirements of "order", you have to what's going on on the basis of sorting this batch file

CodePudding user response:

Fyi:
 ServerShare="\ \ 192.168.3.56 \ d $" 
The UserName="somedomain \ someuser"
Password="somepassword"

The Set NetworkObject=CreateObject (" work "WScript.Net

NetworkObject. MapNetworkDrive ", "ServerShare, False, UserName, Password,"

The Set of FSO=CreateObject (" Scripting. FileSystemObject ")
Set the Directory=FSO. GetFolder (ServerShare)
For Each FileName In the Directory. The Files
WScript. Echo FileName. The Name
Next
Set the FileName=Nothing
Set the Directory=Nothing
The Set of FSO=Nothing

NetworkObject. RemoveNetworkDrive ServerShare, True, False

The Set NetworkObject=Nothing
  •  Tags:  
  • VBA
  • Related