+ Reply to Thread
Results 1 to 8 of 8

Combine Excel Files into One

  1. #1
    Forum Contributor
    Join Date
    09-05-2013
    Location
    Malta
    MS-Off Ver
    Excel 2016
    Posts
    103

    Combine Excel Files into One

    Good morning,

    I extract a daily report which is always in the same format. Col A to K, it has a header and the data underneath. In a month i have about 20 reports.
    I want to combine all the data into one report, (new file) but also add a Col 'L' with the file name from where the data has come.
    All excel files will be in the same folder.

    I'm sure there have been other posts similar to this, perhaps someone can give me the link as i couldnt find by searching with certain keywords 'multiple', combine, etc

    Thanks

    Sam

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combine Excel Files into One

    This is straightforward, using Power Query (Get & Transform Data).

    Something like:

    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Contributor
    Join Date
    09-05-2013
    Location
    Malta
    MS-Off Ver
    Excel 2016
    Posts
    103

    Re: Combine Excel Files into One

    Getting a syntax error

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combine Excel Files into One

    It's not VBA. As I said, it's Power Query (Get & Transform data).

    If you're not sure what to do with the code I gave you, see the link in my signature.

  5. #5
    Forum Contributor
    Join Date
    09-05-2013
    Location
    Malta
    MS-Off Ver
    Excel 2016
    Posts
    103

    Re: Combine Excel Files into One

    Ok got you. Thanks for this!
    The only issue i am having is that when i run the query, the file crashes and closes. When i open it again 'recovered' version, the data is there, but it shouldn't stay crashing.
    I tried it with 3 files with about 700 rows of data each.

    Also, can i remove the sheet name 'Summary', Each file name has a different sheet name; ( a combination of time and date, so it will always be different) (only one sheet per file)

    And, the files i have are CSV, and i changed the coding of the extension to .csv but it failed.

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combine Excel Files into One

    Right. So, they're not Excel files, they're CSV text files. That makes quite a difference...

    Try:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    09-05-2013
    Location
    Malta
    MS-Off Ver
    Excel 2016
    Posts
    103

    Re: Combine Excel Files into One

    Worked perfect the first time. :-)

    This function doesnt seem to be available for older versions of Excel right?
    As i sent it to someone with Excel 2010 and 2013. And i could not open to 'Edit' the query to change file location.

    Sam

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combine Excel Files into One

    Power Query is a (free) addin for Excel 2010 & 2013 - see https://www.excelcampus.com/install-power-query/

    It is available as standard from 2016 onwards, labelled as "Get & Transform Data".

    Along with PowerPivot, it's the best thing to happen to Excel since the pivot table...

+ 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. [SOLVED] Combine many .csv files into one excel sheet
    By Wendso in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-30-2018, 01:50 AM
  2. How to combine multiple Excel Files.
    By alvi_gee in forum Excel General
    Replies: 6
    Last Post: 08-29-2017, 12:53 PM
  3. Need a VBA to combine two excel files
    By nickobob456 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2016, 02:55 PM
  4. Combine two excel files into one
    By Shahip Raja in forum Excel General
    Replies: 5
    Last Post: 11-19-2015, 10:37 AM
  5. Excel vba to tel adobe combine two pdf files based on a spcified list of files
    By Abbadon486 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-30-2014, 12:04 PM
  6. How to combine two excel files?
    By dreamgirl in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-06-2006, 05:07 PM
  7. [SOLVED] how to combine multiple files in ms excel
    By fifi in forum Excel General
    Replies: 1
    Last Post: 01-12-2005, 08:06 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