Working export
Data can now be exported to csv files