Thanks for your feedbacks, I really appreciate it. I'll try to refactor the code according to your suggestions. 

Concerning the bugs you mention, we already used the csv to export the scores, calculate the average for each student in Excel and import the results as grades, everything went fine - but you're right, my code is quite difficult to read. I will refactor it and let you know about my improvements. :)