AbrahamJP AbrahamJP - 8 months ago 68
C# Question

Converting DataSet\DataTable to CSV

Please let me know, if there any way to generate CSV files from a DataTable or DataSet? To be specific, without manually iterating through rows of DataTable and concatenating.

Please help


There are several ways to do that.

One of the simplest (IMO) is using FileHelpers Library

FileHelpers.CsvEngine.DataTableToCsv(dataTable, filename);