How to split a single line text file to multiple lines and export to excel with vb.net 2005
Posted on 2011-10-27
I am trying to read a file on the c: drive that has 1 single line of text. I need to split the line into multiple lines and exprot them into a excel spread sheet with each line being an individual record. I would like to use vb.net 2005 to do this because the original file will contain about 20,000 records. Listed below is a sample of the text in the file. I have placed x's where confidential information should go. The single line of text has multiple spaces in it and the original file had 4 lines per record. I was able to concantanate all the lines to gether and now I don't know how to split them as a individual line and have each line as a record in excel.
In my string the lines are separated by the tab character. There is also some text at the beginning of each record that can be used as a separator as well. (MATCH TYPE)
example of string:
MATCH TYPE: N SUB NAME: xxxxxxxxxxxxxxxxxx SSN CODE: V SSN: xxx-xx-xxxx MPI #: xxxxxxxxx PART: NP FIPS: 111 TRAN STATE: 21 RET NAME: xxxxxxxxxxxxxxxxxxx MULTI SSN: WORKER: 015C002 CLAIM TYPE: DISABILITY RESP DATE: 10/14/2011 ADDL NAMES: SOCIAL SECURITY xxxxxxxxxxxxxxxxxxxxxxxxx BOWLING GREEN KY 42104 MATCH TYPE: N SUB NAME: xxxxxxxxxx SSN CODE: V SSN: xxx-xx-xxxxxxx MPI #: xxxxxxxxxxx PART: NP FIPS: 067 TRAN STATE: 21 RET NAME: xxxxxxxxxx MULTI SSN: WORKER: 034C035 CLAIM TYPE: AUXILIARY RESP DATE: 10/14/2011 ADDL NAMES: SOCIAL SECURITY xxxxxxxxxxxxxxxx DR LEXINGTON KY xxxxxxxxxxxxx MATCH TYPE: N SUB NAME: xxxxxxxxxxxxxxxx SSN CODE: V SSN: xxx-xx-xxxx MPI #: xxxxxxxxx PART: NP FIPS: 047 TRAN STATE: 21 RET NAME: xxxxxxxxxxxx MULTI SSN: WORKER: CLAIM TYPE: DISABILITY RESP DATE: 10/14/2011 ADDL NAMES: SOCIAL SECURITY xxxxxxxxxxxxxxxx MADISON TN 371159906