How to import multiple csv files in one excel spread sheet

Anonymous
2017-01-03T08:47:19+00:00

Hi,

I have hundreds of csv files that contain data which i need to have in one excel sheet. I know I can insert one at a time but i am looking for an easier way. 

Details:

  1. each csv file has two columns of data
  2. i only need the data from the second column, the first column in each csv is identical in all files 
  3. all data should be in one file in one sheet
  4. all csv files have different names and are placed in one folder

I would greatly appreciate the help.

Thanks you

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

8 answers

Sort by: Most helpful
  1. Anonymous
    2017-01-04T16:26:41+00:00

    That would happen if Excel was opening the files as text rather than recognising them as CSV files.

    What is your regional list separator?  Is it different from the separator in the CSV file?

    The code worked perfectly for me (with comma in both cases).

    Replace

        Set WB = Workbooks.Open(stPath & stFile, ReadOnly:=True)

    with

        Workbooks.OpenText stPath & stFile, dataType:=xlDelimited, comma:=True

        Set WB = ActiveWorkbook

    0 comments No comments
  2. Anonymous
    2017-01-04T17:44:24+00:00

    I'm still not getting any results, I must be doing something wrong...

    I recorded what I am doing, maybe you can spot the mistake.

    https://youtu.be/x-A0u7Om3EI

    0 comments No comments
  3. Anonymous
    2017-01-05T00:07:21+00:00

    Just noticed that you omitted the final \ on the path,

    That would explain the failure to find any 500*.csv files in the ATPase folder

    Stick a \ after 500 and try again.

    Sorry I didn't notice that before.

    1 person found this answer helpful.
    0 comments No comments