vb.net to import text file into excel delimited by spaces
<p>was wondering if anyone has an example vb code to import a text file into excel delimited by spaces - regardless of number of spaces. In the text file there are for example 100k lines and in each line, each word can be separated by one, two or three etc spaces. </p>

<p>the result of the import into excel is that each line from the text file is in each row, and each word from each line separated by spaces are in each column of that row.</p>

<p>I tried to accomplish this by reading each line in the text file and then to parse each word for each line, and put these into a variable and then write it to excel. I think this way takes longer, and I am in the middle of parsing each line. But I think importing the text file into excel delimited by spaces is quicker if this can be done. The reason I use vb instead of vba is because vb can create an executable file which can be run by scheduler. Thanks</p>

<pre><code>Dim reader As New System.IO.StreamReader("C:\test.txt")
Dim allLines As List(Of String) = New List(Of String)
Dim stringreader As String
Dim a As String
    stringreader = filereader.ReadLine()

    Do While Not reader.EndOfStream
      allLines.Add(reader.ReadLine())
      stringreader = reader.ReadLine()
      MsgBox("The first line of the file is                " &amp; stringreader)
    Loop
</code></pre>