terminal – Sort files by spreadsheet

I have a folder that contains more than 1000 text files. Text files are supposed to be organized in folders.

I have a spreadsheet that indicates which text file goes to which folder:

enter the description of the image here

Is there any way I can have the "Finder" respond to this spreadsheet, so that I put the correct file in the correct folder? Maybe something related to AppleScript or the terminal? It is just a simple spreadsheet of "Apple Numbers", so I can copy and paste the data into something else.