Can anyone help me how to convert txt file to xls file? Any help will be highly appreciated. Thanks!
Convert XLS to CSV on command line
I guess the above works in reverse.
If you want to work with the data itself in VB6 (I assume you do because of the tag), see this code pinched from this thread:
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "C:\Documents and Settings\...\My Documents\My Database\Text;" & _
"Extended Properties=""Text;HDR=No;"""
rs.Open "Select * from TextFile.csv", cnn, adOpenStatic, adLockReadOnly, adCmdText
'...
'...
'...
rs.Close
cnn.Close
Set cnn = Nothing
CSV is a special case of TXT type where fields are comma-separated. You should be able to nominate any character including space or tab as the delimiter.
精彩评论