Sort files by spreadsheet
The following assumes that neither file nor folder names contain comas (,) and that the exported CSV file uses , as the separator.

As small errors can lead to unexpected results and data loss it's recommended to make a backup first.


Remove any additional columns, header lines and empty lines at the end from your table (so it only contains two columns with file name and folder name respectively)
Export the data as a CSV file named files.csv into the folder containing the text files
Open Terminal
cd into/the/folder
Run perl -pi -e 's/\r\n/\n/;' files.csv to convert the CSV from DOS-like line ending to the standard Unix style
Copy/paste the following (test code, will not create/move anything)

while IFS=, read file folder; do
    # if the folder doesn't exist yet -&gt; create it
    [[ -d "$folder" ]] || echo mkdir "$folder"
    # if file exists -&gt; move it
    if [[ -r "$file" ]]; then
        echo mv "$file" "$folder"/
    else
        echo "Uups, $file not found"
    fi
done &lt; files.csv

If the output looks ok (especially if no "Uups, xxx not found" output is shown, nor any other error messages), run

while IFS=, read file folder; do
    [[ -d "$folder" ]] || mkdir "$folder"
    if [[ -r "$file" ]]; then
        mv "$file" "$folder"/
    else
        echo "Uups, $file not found"
    fi
done &lt; files.csv