C# – Import data from multiple CSV files to an Excel sheet

ccsvexcel

I need to import data from 50 similar csv files to a single excel sheet.
Is there any way to get only selected columns from each file and put them together in one sheet.

Structure of my csv files: A few columns exactly same in all the files. (I want them to be in excel) then one column with same column name but different data which I want to place next to each other with different names in the excel sheet. I do not not want all other remaining columns from csv files.

In short,

  1. read all csv files,
  2. get all the columns which are common to all csv & put in excel sheet.
  3. Now, take one column from each file which has the same header but different data and put one after the other in excel sheet with named from the csv file name.
  4. Leave remaining rest of the columns.
  5. Write excel sheet to a excel file.

Initially I thought it can be easily done, but considering my programming skill in learning stage it is way difficult for me. Please help.

Best Answer

Microsoft Text Driver allows you to read CSV data in a DataSet, making data manipulation easy.

This Stack Overflow question is a good starting point.