Function for downloading data in .csv format