maybe the php function explode
explode the string by the | delimiter and then strip empty values.
for the first row, have it store each of the values as strings with the same name as the value, ie $lastname = $exploded[6];
then, as it loops through the remaining rows that actually contain the data, exploding each line and creating a new array, have it store each of the keys of that array into the database using the variables you set up with the first row.
Just throwing out an idea, I'll try to put some code together later if you're still having trouble.