Import data from multiple CSV files to an Excel sheet

Posted by Chetan on Stack Overflow See other posts from Stack Overflow or by Chetan
Published on 2012-09-21T13:15:03Z Indexed on 2012/09/24 15:37 UTC
Read the original article Hit count: 182

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about excel