Set Spotlight comments from CSV

I have a tab-delimited text file that contains (among other things) a column of filenames and a column of keywords.

I want Automator to be able to scan through a folder of files, check the filenames against those in the csv, then write the corresponding keywords to the spotlight comments for any files that match those in the list.

What I would really like is to be able to tell it which columns to read and include so that I can alter this at will. One day I might want to write keywords and another I might want to write another column called caption, or I may want it to write both.

I can get it to write the entire contents of the csv file into the Spotlight comments for every file in the folder, but I’m having a real problem getting it to read and write line by line (ie. parsing the csv file).

Any help would be most appreciated.