Create, load, or edit a query in Excel (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

Import and analyze data

Import data

Import data

Create, load, or edit a query in Excel (Power Query)

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

Power Query offers several ways to create and loadPower queries into your workbook. You can also set default query load settings in the Query Options window.

Tip To tell if data ina worksheetis shaped by Power Query, select a cell of data, and if the Query context ribbon tab appears, then the data was loaded from Power Query.

Create, load, or edit a query in Excel (Power Query) (2)

Know which environment you're in Power Query is well-integrated into the Excel user interface, especially when you import data, work with connections, and edit Pivot Tables, Excel tables, and named ranges. To avoid confusion, it’s important to know which environment you are currently in, Excel or Power Query, at any point in time.

The familiar Excel worksheet , ribbon, and grid

The Power Query Editor ribbon and data preview

Create, load, or edit a query in Excel (Power Query) (3) Create, load, or edit a query in Excel (Power Query) (4)

For example, manipulating data in an Excel worksheet is fundamentally different than Power Query. Furthermore, the connected data that you see in an Excel worksheet, may or may not have Power Query working behind the scenes to shape the data. This only occurs when you load the data to a worksheet orData Modelfrom Power Query.

Rename worksheet tabs It’s a good idea to rename worksheet tabs in a meaningful way, especially if you have a lot of them. It’s particularly important to clarify the difference between a worksheet of data, and a worksheet loaded from the Power Query Editor. Even if you have only two worksheets, one with an Excel table, called Sheet1, and the other a query created by importing that Excel table, called Table1, it’s easy to get confused. It’s always good practice to change the default names of worksheet tabs to names that make more sense to you. For example, rename Sheet1 to DataTable and Table1 to QueryTable. Now it’s clear which tab has the data and which tab has the query.

You can either create a query from imported data or create a blank query.

Create a query from imported data

This is the most common way to create a query.

  1. Import some data. For more information, see Import data from external data sources.

  2. Select a cell in the data and then select Query > Edit.

Create a blank query

You may want to just start from scratch. There are two ways to do this.

  • Select Data > Get Data > From Other Sources > Blank Query.

  • Select Data > Get Data > Launch Power Query Editor.

At this point, you can manually add steps and formulas if you know the Power Query M formula languagewell.

Or you can select Home and then select a command in the New Query group. Do one of the following.

  • Select New Source to add a data source. This command is just like the Data > Get Data command in the Excel ribbon.

  • Select Recent Sources to select from a data source you have been working with. This command is just like the Data > Recent Sources command in the Excel ribbon.

  • Select Enter Data to manually enter data. You might choose this command to try out the Power Query Editor independent of an external data source.

Assuming your query is valid and has no errors, you can load it back to a worksheet or Data Model.

Load a queryfrom the Power Query Editor

In the Power Query Editor, do one of the following:

  • To load to a worksheet, select Home > Close & Load > Close & Load.

  • To load to a Data Model, select Home > Close & Load > Close & Load To.

    In the Import Data dialog box, select Add this data to the Data Model.

Tip Sometimes the Load To command is dimmed or disabled. This can occur the first time you create a query in a workbook. If this occurs, select Close & Load, in the new worksheet, select Data > Queries & Connections > Queries tab, right click the query, and then select Load To. Alternatively, on thePower Query Editor ribbon select Query > Load To.

Load a query from the Queries and Connections pane

In Excel, you may want to load a query into another worksheet or Data Model.

  1. In Excel, select Data > Queries & Connections, and then select the Queries tab.

  2. In the list of queries, locate the query, right click the query, and then select Load To. TheImport Data dialog box appears.

  3. Decide how you want to import the data, and then selectOK. For more information about using this dialog box, select the question mark (?).

There are several ways to edit a query loaded to a worksheet.

Edit a query from data in Excel worksheet

  • To edit a query, locate one previously loaded from the Power Query Editor, select a cell in the data, and then select Query > Edit.

Edit a query from the Queries & Connections pane

You may find the Queries & Connections pane is more convenient to use when you have many queries in one workbook and you want to quickly find one.

  1. In Excel, select Data > Queries & Connections, and then select the Queries tab.

  2. In the list of queries, locate the query, right click the query, and then select Edit.

Edit a query from the Query Properties dialog box

  • In Excel, select Data > Data & Connections > Queries tab, right click the query and select Properties, select the Definition tab in the Properties dialog box, and then select Edit Query.

Tip If you are in a worksheet with a query, select Data > Properties, select theDefinition tabin the Properties dialog box, and then select Edit Query.

A Data Model typically contains several tables arranged in a relationship. You load a query to a Data Model by using the Load To command to display the Import Data dialog box, and then selecting the Add this data to the Data Model check box. For more information about Data Models, see Find out which data sources are used in a workbook data model, Create a Data Model in Excel, and Use multiple tables to create a PivotTable.

  1. To open the Data Model, select Power Pivot>Manage.

  2. At the bottom of the Power Pivot window, select the worksheet tab of the table you want.

    Confirm that the correct table displays. A Data Model can have many tables.

  3. Note the name of the table.

  4. To close the Power Pivot window, select File > Close. It may take a few seconds to reclaim memory.

  5. Select Data > Connections & Properties > Queries tab, right click the query, and then select Edit.

  6. When finished making changes in the Power Query Editor, select File > Close & Load.

Result

The query in the worksheet and the table in the Data Model are updated.

If you notice that loading a query to a Data Model takes much longer than loading to a worksheet, check your Power Query steps to see if you are filtering a text column or a List structured column by using a Contains operator. This action causes Excel to enumerate again through the entire data set for each row. Furthermore, Excel can’t effectively use multithreaded execution. As a workaround, try using a different operator such as Equals or Begins With.

Microsoft is aware of this problem and it is under investigation.

You canload a Power Query:

  • To a worksheet. In the Power Query Editor, select Home > Close & Load > Close & Load.

  • To a Data Model.In the Power Query Editor, select Home > Close & Load > Close & LoadTo.

    By default, Power Query loads queries to a new worksheet when loading a single query, and loads multiple queries at the same time to the DataModel. You can change the defaultbehavior for all your workbooks or just the current workbook.When setting these options, Power Query doesn't changequery results in the worksheet or the Data Model data and annotations.

    You can also dynamically override the default settings for a query by using the Import dialog box which displays after you selectClose & LoadTo.

Global settings that apply to all your workbooks

  1. In the PowerQuery Editor, select File > Options and settings > Query Options.

  2. In the Query Options dialog box, on the left side, under theGLOBALsection, select Data Load.

  3. Under theDefault Query Load Settings section, do the following:

    • SelectUse standard load settings.

    • Select Specify custom default load settings,and then select or clear Load to worksheet or Load to Data Model.

Tip At the bottom of the dialog box, you can select Restore Defaults to conveniently return to the default settings.

Workbook settings that only apply to the current workbook

  1. In the Query Options dialog box, on the left side, under the CURRENTWORKBOOKsection, select Data Load.

  2. Do one or more of the following:

    • Under Type Detection, select or clear Detect column types and headers for unstructured sources.

      The default behavior is to detect them. Clear this option if you prefer to shape the data yourself.

    • Under Relationships, select or clear Create relationships between tables when adding to the Data Model for the first time.

      Before loading to the Data Model, the default behavior is to find existing relationships between tables, such as foreign keys in arelational database and import them with the data. Clear this option if you prefer to do this on your own.

    • Under Relationships, select or clear Update relationships when refreshing queries loaded to the Data Model.

      The default behavior is to not update relationships. When refreshing queries already loaded to the Data Model, Power Query finds existing relationships between tables such as foreign keys in a relational database and updates them. This might remove relationships created manually after the data was imported or introduce new relationships. However, if you want to do this, select the option.

    • Under Background Data, select or clear Allow data previews to download in the background.

      The default behavior is to download data previews in the background. Clear this option if you can want to see all the data right away.

See Also

Power Query for Excel Help

Manage queries in Excel

Need more help?

Want more options?

Discover Community

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

Create, load, or edit a query in Excel (Power Query) (5)

Microsoft 365 subscription benefits

Create, load, or edit a query in Excel (Power Query) (6)

Microsoft 365 training

Create, load, or edit a query in Excel (Power Query) (7)

Microsoft security

Create, load, or edit a query in Excel (Power Query) (8)

Accessibility center

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

Create, load, or edit a query in Excel (Power Query) (9)

Ask the Microsoft Community

Create, load, or edit a query in Excel (Power Query) (10)

Microsoft Tech Community

Thank you for your feedback!

×

Create, load, or edit a query in Excel (Power Query) (2024)
Top Articles
How to Swap ETH to BNB on MetaMask - Dappgrid
Navigating Puerto Rico with Uber - Casa Del Caribe Inn
Bank Of America Financial Center Irvington Photos
Tattoo Shops Lansing Il
Cranes For Sale in United States| IronPlanet
Skyward Sinton
Libiyi Sawsharpener
Ffxiv Palm Chippings
Kraziithegreat
Did 9Anime Rebrand
Gameday Red Sox
Goteach11
MADRID BALANZA, MªJ., y VIZCAÍNO SÁNCHEZ, J., 2008, "Collares de época bizantina procedentes de la necrópolis oriental de Carthago Spartaria", Verdolay, nº10, p.173-196.
Cvs Devoted Catalog
Delectable Birthday Dyes
Rosemary Beach, Panama City Beach, FL Real Estate & Homes for Sale | realtor.com®
Colts seventh rotation of thin secondary raises concerns on roster evaluation
Industry Talk: Im Gespräch mit den Machern von Magicseaweed
Rainfall Map Oklahoma
Kitty Piggy Ssbbw
Petco Vet Clinic Appointment
Invitation Homes plans to spend $1 billion buying houses in an already overheated market. Here's its presentation to investors setting out its playbook.
Orange Pill 44 291
The Ultimate Guide to Extras Casting: Everything You Need to Know - MyCastingFile
Boston Dynamics’ new humanoid moves like no robot you’ve ever seen
Directions To Cvs Pharmacy
Ihub Fnma Message Board
Cb2 South Coast Plaza
Access a Shared Resource | Computing for Arts + Sciences
Maine Racer Swap And Sell
Taylored Services Hardeeville Sc
Cvs Sport Physicals
The Bold and the Beautiful
Storelink Afs
Elisabeth Shue breaks silence about her top-secret 'Cobra Kai' appearance
The Transformation Of Vanessa Ray From Childhood To Blue Bloods - Looper
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
Craigslist Mexicali Cars And Trucks - By Owner
11301 Lakeline Blvd Parkline Plaza Ctr Ste 150
Jasgotgass2
Gfs Ordering Online
The Angel Next Door Spoils Me Rotten Gogoanime
Setx Sports
Courtney Roberson Rob Dyrdek
John M. Oakey & Son Funeral Home And Crematory Obituaries
From Grindr to Scruff: The best dating apps for gay, bi, and queer men in 2024
Vci Classified Paducah
Dayton Overdrive
Lightfoot 247
Wvu Workday
Costco Tire Promo Code Michelin 2022
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 6280

Rating: 4.8 / 5 (68 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.