Reading data in from a csv can be handled in many ways. One solution is to read the csv file into an array. From there you can do work on the array.
csv