Closed Thread
Results 1 to 6 of 6

merging csv files into a single xls file

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    2

    merging csv files into a single xls file

    Hi,
    I have 5 csv data files called a.csv, b.csv, c.csv, d.csv, and e.csv. All of these files have the same structure. Is there a way to merge these files into a spreadsheet with a.csv, b.csv, c.csv, d.csv, and e.csv as 1st, 2nd, 3rd, 4th, and 4th sheets, respectively. I am using open office calc and don't want to merge the files manually anytime I create them. Any reply is appreciated.

    Regards,
    Reza

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: merging csv files into a single xls file

    Hello and welcome to the forum. If I understand you correctly, you want to automatically pull each csv file into a new worksheet, but not all five csv files into one excel worksheet.

    This can be done with vba, but if you want to implement this in OpenOffice, you will need to know the equivalent object names used in that program. I personally tried to use code that works fine in Microsoft Excel directly in OpenOffice and it errored everywhere. If you don't find anyone here with experience writing macros for OpenOffice then I would suggest you post this question in an OpenOffice forum.

    Good luck.

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    04-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: merging csv files into a single xls file

    Hi abousetta,
    Thank you for your reply. Actually, I would like to have all 5 individual csv files in a single excel spreadsheet.

    Regards,
    Reza

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: merging csv files into a single xls file

    Hi,

    This will bring in all the CSV files in a folder into the activesheet of Excel. Let me know if you have any questions.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-03-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: merging csv files into a single xls file

    hihi abousetta;
    i love your script...
    I encounter the similar problem before, and after using the code;
    it work...


    btw the way; what if i only want to import the data Starting from row 11 onward?

    i need to merge all the csv file but my data needed start from 11th row onward..
    please help me as i still a beginner in VBA.

    Can anyone with similar expertise give me a hand?

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: merging csv files into a single xls file

    windslayer,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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