Generate CSV file