add a function that exports table data to csv file