Import data from a folder with multiple files (Power Query) (2024)

Skip to main content

Microsoft

Support

Support

Sign in

Sign in with Microsoft

Sign in or create an account.

Hello,

Select a different account.

You have multiple accounts

Choose the account you want to sign in with.

Excel for Microsoft 365 Excel 2021 Excel 2019 Excel 2016 More...Less

Use Power Query to combine multiple files with the same schema stored in a single folder into one table. For example, each month you want to combine budget workbooks from multiple departments, where the columns are the same, but the number of rows and values differ in each workbook. Once you set it up, you can apply additional transformations as you would with any single imported data source andthen refresh the data to see results for each month.

Import data from a folder with multiple files (Power Query) (2)

Note This topic shows how to combine files from a folder. You can also combine files stored in SharePoint, Azure Blob Storage, and Azure Data Lake Storage. The process is similar.

Keep it simple:

  • Ensure that all the files you want to combine are contained in a dedicated folder without extraneous files. Otherwise, all files in the folder and any subfolders you select are included in the data to be combined.

  • Each file should have the same schema with consistent column headers, data types, and number of columns. The columns do not have to be in the same order as the matching is done by column names.

  • If possible, avoid unrelated data objects for data sources that can have more than one data object, such as a JSON file, an Excel workbook, or Access database.

Each of these files followa simple pattern, only one table of data in each file.

  1. SelectData> Get Data > From File > From Folder. The Browse dialog box appears.

  2. Locate the folder containing the files you want to combine.

  3. A list of the files in the folder appears in the <Folder path> dialog box.Verify that all the files you want are listed.

    Import data from a folder with multiple files (Power Query) (3)
  4. Select one of the commands at the bottom of the dialog box, for exampleCombine > Combine & Load. There are additional commands discussed in the section About all those commands.

  5. If you select any Combine command, The Combine Files dialog box appears. To change file settings, select each file from the Sample File box, set the File Origin, Delimiter, and Data Type Detection as desired. You can also select or clear the Skip files with errors checkbox at the bottom of the dialog box.

  6. Select OK.

Result

Power Query automatically creates queriesto consolidate the data from each file into a worksheet. The query steps and columns created depend on which command you choose. For more information, see the section, About all those queries.

  1. SelectData> Get Data > From File > From Folder. The Browsedialog box appears.

  2. Locate the folder containing the files you want to combine.

  3. A list of the files in the folder appears in the <Folder path> dialog box.Verify that all the files you want are listed.

  4. Select one of the commands at the bottom of the dialog box, for exampleCombine > Combine & Transform. There are additional commands discussed in the section About all those commands.

    The Power Query Editor appears.

  5. The Value column is a structured List column. Select the Expand

    Import data from a folder with multiple files (Power Query) (4)

    icon, and then select Expand to New rows.

    Import data from a folder with multiple files (Power Query) (5)
  6. The Valuecolumn is now a structured Record column.Select the Expand

    Import data from a folder with multiple files (Power Query) (6)

    icon. A drop-down dialog box appears.

    Import data from a folder with multiple files (Power Query) (7)
  7. Keep all the columns selected. You may want to clear the Use original column name as a prefix check box. Select OK.

  8. Select all the columns that contain data values.Select Home, the arrow next to Remove Columns, and then select Remove Other Columns.

  9. Select Home > Close & Load.

Result

Power Query automatically creates queriesto consolidate the data from each file into a worksheet. The query steps and columns created depend on which command you choose.For more information, see the section, About all those queries.

Each of these data sources can have more than one object to import. An Excel workbook can have multiple worksheets, Excel tables, or named ranges. An Access database can have multiple tables and queries.

  1. SelectData> Get Data > From File > From Folder. The Browsedialog box appears.

  2. Locate the folder containing the files you want to combine.

  3. A list of the files in the folder appears in the <Folder path> dialog box.Verify that all the files you want are listed.

  4. Select one of the commands at the bottom of the dialog box, for exampleCombine > Combine & Load. There are additional commands discussed in the section About all those commands.

  5. In the Combine Files dialog box:

    • In the Sample File box, select a file to use as sample data used to create the queries. You can either not select an object or select just one object. But,you can't select more than one.

    • If you have many objects, use the Search box to locate an object or the Display Options along with the Refresh button to filter the list.

    • Select or clear the Skip files with errors checkbox at the bottom of the dialog box.

  6. Select OK.

Result

Power Query automatically creates a query to consolidate the data from each file into a worksheet. The query steps and columns created depend on which command you choose.For more information, see the section, About all those queries.

For more flexibility, you can explicitly combine files in the Power Query Editor by using the Combine Files command. Let’s say the source folder has a mixture of file types and subfolders, and you want to target specific files with the same file type and schema but not others. This can improve performance and help simplify your transformations.

  1. Select Data > Get Data > From File > From Folder. The Browse dialog box appears.

  2. Locate the folder containing the files you want to combine, and then select Open.

  3. A list of all the files in the folder and subfolders appears in the <Folder path> dialog box. Verify that all the files you want are listed.

  4. Select Transform Data at the bottom. The Power Query Editor opens and displays all the files in the folder and any subfolders.

  5. To select the files you want, filter columns, such as Extension or Folder Path.

  6. To combine the files into single table, select the Content column that contains each Binary (usually the first column), and then select Home > Combine Files. The Combine Files dialog box appears.

  7. Power Query analyzes an example file, by default the first file in the list, to use the correct connector and identify matching columns.

    To use a different file for the example file, select it from the Sample File drop-down list.

  8. Optionally, at the bottom, select Skip files with errors to exclude those files from the result.

  9. Select OK.

Result

Power Query automatically creates a queriesto consolidate the data from each file into a worksheet. The query steps and columns created depend on which command you choose.For more information, see the section, About all those queries.

There are several commands you can select and each one has a different purpose.

  • Combine and Transform Data To combine all the files with a query, and then launch the Power Query Editor, select Combine > Combine and Transform Data.

  • Combine and LoadTo display the Sample file dialog box, create a query, and then load to worksheet, select Combine > Combine and Load.

  • Combine andLoad ToTo display the Sample file dialog box, create a query, and then display Import dialog box, select Combine > Combine and Load To.

  • Load To create a query with one step, and then load to a worksheet, select Load > Load.

  • Load ToTo create a query with one step, and then display the Import dialog box, select Load > Load To.

  • Transform DataTo create a query with one step, and then launch the Power Query Editor, select Transform Data.

However you combine files, several supporting queries are created in the Queries pane under the "Helper Queries" group.

Import data from a folder with multiple files (Power Query) (8)

  • Power Query creates a"Sample File" query based on the example query.

  • A "Transform File"function query uses the "Parameter1" query to specify each file (or binary) as input to the "Sample File"query. This query also creates the Content column containing the file contents and automatically expands the structured Record column to add the column data to the results.The "Transform File"and "Sample File" queriesare linked, so that changes to the "Sample File"query are reflected in the "Transform File" query.

  • The query containing the final results is in the "Other queries"group. By default, it is named after the folder you imported the files from.

For further investigation, right click each query and select Edit to examine each query step and to see how the queries work in concert.

See Also

Power Query for Excel Help

Append queries

Combine files overview (docs.com)

Combine CSV files in Power Query (docs.com)

Need more help?

Want more options?

Discover Community

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Import data from a folder with multiple files (Power Query) (9)

Microsoft 365 subscription benefits

Import data from a folder with multiple files (Power Query) (10)

Microsoft 365 training

Import data from a folder with multiple files (Power Query) (11)

Microsoft security

Import data from a folder with multiple files (Power Query) (12)

Accessibility center

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Import data from a folder with multiple files (Power Query) (13)

Ask the Microsoft Community

Import data from a folder with multiple files (Power Query) (14)

Microsoft Tech Community

Thank you for your feedback!

×

Import data from a folder with multiple files (Power Query) (2024)

FAQs

How do I combine data from a folder in Power Query? ›

Combine and Transform Data To combine all the files with a query, and then launch the Power Query Editor, select Combine > Combine and Transform Data. Combine and Load To display the Sample file dialog box, create a query, and then load to worksheet, select Combine > Combine and Load.

How do I extract data from a folder in Power Query? ›

Double-click on the double arrows at the top of the Content column to get the data from the files in your desired folder. Finally, choose the table/sheet that you want, and when you click OK Power Query will grab that same table/sheet from each file in the folder!

How do you load a folder in Power Query? ›

To connect to a folder from Power Query Desktop: Select the Folder option in the connector selection. Enter the path to the folder you want to load, or select Browse to browse to the folder you want to load. Then select OK.

How to get data from multiple Excel files into one sheet? ›

Go to Data > Consolidate. In the Function box, select the function that you want Excel to use to consolidate the data. To indicate where the labels are located in the source ranges, select the check boxes under Use labels in: either the Top row, the Left column, or both. In each source sheet, select your data.

What is the difference between merge and append in Power Query? ›

There are two primary ways of combining queries: merging and appending. For one or more columns that you'd like to add to another query, you merge the queries. For one or more rows of data that you'd like to add to an existing query, you append the query.

How do I combine two data sources in Power Query? ›

Select a cell in the query, and then select Query > Merge. In the Merge dialog box, select Products as the primary table, and select Total Sales as the secondary or related query to merge. Total Sales will become a new structured column with an expand icon.

How do you load all data in a Power Query? ›

  1. In the Power Query Editor, select File > Options and settings > Query Options.
  2. In the Query Options dialog box, on the left side, under the GLOBAL section, select Data Load.
  3. Under the Default Query Load Settings section, do the following: Select Use standard load settings.

How to query a folder in Excel? ›

Replies (1) 
  1. In Excel, go to the Data tab and select "From Other Sources" > "From Folder".
  2. In the "From Folder" dialog box, browse to the folder where the file is stored and click "OK".
  3. Power Query will display a list of all the files in the folder.
Nov 15, 2023

How to load a file into a Power Query? ›

File: Text/CSV
  1. Select Data > Get Data > From File > From Text/CSV.
  2. In the Comma-Separated Values Browse dialog box, browse for or type a path to the file that you want to query.
  3. Select Open.

How do I import data from multiple files in Excel? ›

4 Answers
  1. Select Data > Get Data > From File > From Folder.
  2. Select the folder containing the files you want to combine.
  3. A list of the files in the folder appears in the dialog box. ...
  4. For further steps choose Combine > Combine & Load.
Jun 2, 2023

How do you append multiple Excel files into one? ›

Press Alt + F8 to open the Macro dialog. Under Macro name, select MergeExcelFiles and click Run. The standard explorer window will open, you select one or more workbooks you want to combine, and click Open. To select multiple files, hold down the Ctrl key while clicking the file names.

How do you combine values in Power Query? ›

In the Custom Column Formula box, enter an ampersand (&) after the first column that you inserted. The ampersand (&) operator is used to combine values in Power Query in the same way as in Excel.

How do I merge data folders? ›

How do I merge folders in Windows? To merge folders in Windows, simply drag and drop one folder into another. If there are duplicate files, you will be prompted to replace or skip them.

How do you group data in Power Query? ›

Select Home > Group by. In the Group by dialog box, select Advanced to select more than one column to group by. To add another column, select Add Grouping.

How do I combine two lists in Power Query? ›

  1. Syntax. List.Combine(lists as list) as list.
  2. About. Takes a list of lists, lists , and merges them into a single new list.
  3. Example 1. Combine the two simple lists {1, 2} and {3, 4}. Usage List.Combine({{1, 2}, {3, 4}}) ...
  4. Example 2. Combine the two lists, {1, 2} and {3, {4, 5}}, one of which contains a nested list.
Jul 15, 2024

Top Articles
Ancient Currency: Coin Standards of the World's Empires | TitleMax
Top 8 Types of Cyber Attacks - Check Point Software
How To Get Free Credits On Smartjailmail
When Is the Best Time To Buy an RV?
Mikayla Campinos Videos: A Deep Dive Into The Rising Star
Weather In Moon Township 10 Days
Does Publix Have Sephora Gift Cards
Planets Visible Tonight Virginia
What Happened To Maxwell Laughlin
Lima Funeral Home Bristol Ri Obituaries
Conan Exiles Colored Crystal
Q33 Bus Schedule Pdf
Sport-News heute – Schweiz & International | aktuell im Ticker
Destiny 2 Salvage Activity (How to Complete, Rewards & Mission)
Sonic Fan Games Hq
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Glenda Mitchell Law Firm: Law Firm Profile
Decosmo Industrial Auctions
Great Clips Grandview Station Marion Reviews
Ford F-350 Models Trim Levels and Packages
Ac-15 Gungeon
Yugen Manga Jinx Cap 19
Troy Gamefarm Prices
Arrest Gif
Ultra Ball Pixelmon
Generator Supercenter Heartland
Dl.high Stakes Sweeps Download
91 Octane Gas Prices Near Me
Franklin Villafuerte Osorio
Kids and Adult Dinosaur Costume
Moonrise Time Tonight Near Me
Sf Bay Area Craigslist Com
Compress PDF - quick, online, free
Darrell Waltrip Off Road Center
Craigslist Car For Sale By Owner
Obsidian Guard's Skullsplitter
Laurin Funeral Home | Buried In Work
Myql Loan Login
Janaki Kalaganaledu Serial Today Episode Written Update
Below Five Store Near Me
Wilson Tire And Auto Service Gambrills Photos
National Weather Service Richmond Va
Citizens Bank Park - Clio
Babykeilani
Marcal Paper Products - Nassau Paper Company Ltd. -
The Latest Books, Reports, Videos, and Audiobooks - O'Reilly Media
Bismarck Mandan Mugshots
2000 Fortnite Symbols
Kindlerso
Latest Posts
Article information

Author: Jerrold Considine

Last Updated:

Views: 6419

Rating: 4.8 / 5 (58 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Jerrold Considine

Birthday: 1993-11-03

Address: Suite 447 3463 Marybelle Circles, New Marlin, AL 20765

Phone: +5816749283868

Job: Sales Executive

Hobby: Air sports, Sand art, Electronics, LARPing, Baseball, Book restoration, Puzzles

Introduction: My name is Jerrold Considine, I am a combative, cheerful, encouraging, happy, enthusiastic, funny, kind person who loves writing and wants to share my knowledge and understanding with you.