If you have the csvsimple [1] latex package available this can be done as latex macro. This allows for easy integration with other latex packages (drawing stuff with tikz for example [2]).
Python and a makefile might perform better for larger data sets though.