Why not use all the code Jesus Reyes has already written in the grids unit?
Add a line such as
as the first line of your data file.
Drop a TStringGrid on your main form.
Set its properties along these lines:
Grid.FixedCols := 0;
Grid.LoadFromCSVFile('your data file.txt','|',True);
Grid.AutoSizeColumns;
Grid.ColumnClickSorts := True;
Now a simple click on the column header sorts the strings. To sort numeric columns you have to do a bit of work yourself.
If you strip the opening and closing '|' from each line of your data file you will avoid having empty first and last columns in the grid.