Add export to csv function