Esempio n. 1
0
 /// <summary>
 /// Read a CSV file into a table
 /// </summary>
 /// <param name="filename">Filename of CSV file</param>
 /// <param name="headerRow">True if the first row contains column names</param>
 /// <param name="scanRows">The number of rows to scan for types when building a DataTable (0 to scan the whole file)</param>
 /// <returns>System.Data.DataTable object that contains the CSV data</returns>
 public static DataTable ReadCSVFile(string filename, bool headerRow, int scanRows)
 {
     using (CSVReader reader = new CSVReader(new FileInfo(filename))) {
         reader.ScanRows = scanRows;
         return(reader.CreateDataTable(headerRow));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Read a CSV file into a table
 /// </summary>
 /// <param name="filename">Filename of CSV file</param>
 /// <param name="headerRow">True if the first row contains column names</param>
 /// <returns>System.Data.DataTable object that contains the CSV data</returns>
 public static DataTable ReadCSVFile(string filename, bool headerRow)
 {
     using (CSVReader reader = new CSVReader(new FileInfo(filename)))
         return reader.CreateDataTable(headerRow);
 }
Esempio n. 3
0
 /// <summary>
 /// Read a CSV file into a table
 /// </summary>
 /// <param name="filename">Filename of CSV file</param>
 /// <param name="headerRow">True if the first row contains column names</param>
 /// <param name="scanRows">The number of rows to scan for types when building a DataTable (0 to scan the whole file)</param>
 /// <returns>System.Data.DataTable object that contains the CSV data</returns>
 public static DataTable ReadCSVFile(string filename, bool headerRow, int scanRows)
 {
     using (CSVReader reader = new CSVReader(new FileInfo(filename)))
     {
         reader.ScanRows = scanRows;
         return reader.CreateDataTable(headerRow);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Read a CSV file into a table
 /// </summary>
 /// <param name="filename">Filename of CSV file</param>
 /// <param name="headerRow">True if the first row contains column names</param>
 /// <returns>System.Data.DataTable object that contains the CSV data</returns>
 public static DataTable ReadCSVFile(string filename, bool headerRow)
 {
     using (CSVReader reader = new CSVReader(new FileInfo(filename)))
         return(reader.CreateDataTable(headerRow));
 }
Esempio n. 5
0
 /// <summary>
 /// Convert a CSV-formatted string into a DataTable
 /// </summary>
 /// <param name="headerRow">True if the first row contains headers</param>
 /// <returns>System.Data.DataTable that contains the CSV data</returns>
 public static DataTable ReadCSVTable(this string input, bool headerRow)
 {
     using (CSVReader reader = new CSVReader(input))
         return(reader.CreateDataTable(headerRow));
 }
Esempio n. 6
0
 public static DataTable ReadCSVData(string csvData, bool headerRow)
 {
     using (CSVReader reader = new CSVReader(csvData: csvData))
         return(reader.CreateDataTable(headerRow));
 }