Write csv file to database