+ Reply to Thread
Results 1 to 3 of 3

Merge multiple csv files with the same file name into one csv

  1. #1
    Registered User
    Join Date
    04-04-2020
    Location
    Dubai
    MS-Off Ver
    Excel Offce .32
    Posts
    1

    Merge multiple csv files with the same file name into one csv

    Dear Expert,

    Let's say i have the below files in two folders:

    Folder 1:
    ex1.csv
    ex2.csv
    ex3.csv
    ex4.csv
    ex5.csv
    ex6.csv
    ....

    Folder 2:
    ex1.csv
    ex2.csv
    ex3.csv
    ex4.csv
    ex5.csv
    ex6.csv
    ....

    Folder 3:
    The final sheet should be saved here

    Can someone tell me how I can merge ex1.csv from "folder 1" with ex1.csv from "folder 2" and save it under the name ex1.csv in "folder 3"?4
    Also can I remove the first row of ex1.csv in folder 2 so I don't have two headers?

    I have 3000 files that are duplicated twice.

    Thank you

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Merge multiple csv files with the same file name into one csv

    Hi chocoprince and welcome to the forum,

    In the newer versions of Excel there is a tool called Power Query or Get & Transform that has the ability to do your problem. Here are two sites that go step by step through the process:
    https://support.office.com/en-us/art...8-6a00041c90e4
    https://exceleratorbi.com.au/combine...s-power-query/
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Merge multiple csv files with the same file name into one csv

    Quote Originally Posted by chocoprince View Post
    Can someone tell me how I can merge ex1.csv from "folder 1" with ex1.csv from "folder 2" and save it under the name ex1.csv in "folder 3"?4
    Also can I remove the first row of ex1.csv in folder 2 so I don't have two headers?
    Copy all files from Folder1 to Folder3 then for each file in Folder3
    if exists the same name file in Folder2 (see VBA Dir function)
    so open the file in Folder3 in Append mode (see the VBA Open statement) and open the file in Folder2 in Input mode
    then read each line from Folder2 file and write it to the Folder3 file (like you can see in the VBA help examples) …

    For further help post at least some source files and expected result files with the appropriate technical explanation
    in order any helper has all the necessary without anything to guess
    or you must be very confident with your Excel / VBA skills to amend any code !

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Merge multiple excel files into single file as different sheets
    By saidineshbabu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-18-2015, 12:38 AM
  2. [SOLVED] Macro to merge multiple excel files with same tab name into one file
    By Ardiko in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-16-2013, 04:53 PM
  3. [SOLVED] How to merge multiple excel files(xls) in one folder into a new xls file.
    By Hayk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2013, 11:48 AM
  4. [SOLVED] How to merge multiple xlsm files into a single file
    By gmatoka in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-18-2012, 07:52 AM
  5. merge specific cell from multiple files into 1 file
    By pow828 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-18-2011, 12:35 PM
  6. How to merge multiple Excel Files into One File
    By janeshh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2009, 08:09 AM
  7. [SOLVED] How do I merge multiple xls files into one file?
    By Gianni in forum Excel General
    Replies: 3
    Last Post: 06-14-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1