integrated csv writing of data