Searching a CSV file using the value of a cell from another CSV file

I’m trying to send emails to school secretaries in my district notifying them of student password resets. There are two CSV files involved:

  • The first one is generated by a script (that I've already written). It contains three columns: student's email address, the student's new password, and the school the student belongs to.
  • The second one contains only two columns: school, and secretary's email.
I want to search the first column of the second CSV file for values found in the third column of the first CSV. After that, I'll need a way to access the different values in that row (column by column) and do stuff with them (so I can get their name).

Basically, use the second file as a map of the school name to the secretary’s email address. How do I do this?

If I got you right you can use nested foreach loops to achieve what you need. What do you have already? When you post code, please format it as code. That would be nice for sample data as well.