How to convert the text file data to datatable or excel file?

Read Text File into a string variable.

Split on VbCrLf + VbCrLf (basically split on every blank line)

Now you have an array of the records. Then you can For Each through the array and split each one on VbCrLf. Using Add Data Row, your array(0) will be Name and array(1) will be Age. You can just use Replace to get rid of "Name " and "Age " each time.

1 Like