Table of Contents
Power Query Quick View
What is Power Query?
Clean Excel data with Power Query
Import and reorganize data using Power Query
Home Software Tutorial Office Software How to Clean Up and Import Data Using Power Query in Excel

How to Clean Up and Import Data Using Power Query in Excel

Feb 06, 2025 pm 11:41 PM

Power Query Quick View

  • What is Power Query?
  • Clean Excel data with Power Query
  • Import and reorganize data using Power Query

In 2010, Microsoft added another technical term to Excel's term list - Power Query, but it's not as complicated as it sounds. In fact, once you start using it, the learning curve is not steep, provided you have at least an entry-level understanding of Microsoft Excel.

What is Power Query?

Power Query was originally introduced as an add-in in Excel, but given its usefulness, it has become a native tool for Excel since 2016.

In short, the main purpose of Power Query is: Save you time processing data. More specifically, it can be used to clean up data already in Excel, import and organize data from many different places, or merge various files before loading the data into a specific location of your choice. You can also refresh the data to make sure you have the latest version.

Excel's Power Query tool can be found in the Get and Convert Data group on the Data tab.

How to Clean Up and Import Data Using Power Query in Excel

In this article, I will show you how to use Power Query to clean up your data and how to import and organize your data from another spreadsheet.

Clean Excel data with Power Query

I always use Power Query to clean up data in my Excel tables. Suppose you have copied the list of email addresses copied from the CC field of the Outlook email to cell A1, and you want the list to be converted to a table containing the first (or title), last name, and email address. While you can use Excel functions to do this, it is easier to do this in Excel's Power Query Editor (and the learning curve is less steep!).

How to Clean Up and Import Data Using Power Query in Excel

It should be noted here that this is just a simple example of how you can use Power Query to organize your data. If you have never used Power Query before, follow these steps to learn its most basic way of working, and then you can try using other Power Query tools to organize more complex Excel data.

First, open the Data tab on the ribbon, and then click Self Table/Area in the Data group.

How to Clean Up and Import Data Using Power Query in Excel

Then, in the Create Table dialog, make sure the correct cell is selected and tell Excel whether your data contains the title--in my case it didn't, so I'll uncheck the box- —And click OK.

How to Clean Up and Import Data Using Power Query in Excel

Excel will then open the Power Query Editor, where you can do a lot of weird things, including organizing your data.

The first step is to split each email address into its own rows, so right-click the column header, hover over "Split Columns", and click "By Separator". You can choose other ways to split the data, such as after a specific number of characters or between capital letters. However, in my case the email address is separated by a semicolon, so the separator option works.

How to Clean Up and Import Data Using Power Query in Excel

In the Split Columns by Separator dialog box, select "Semi-colon" in the drop-down list. Then, click Advanced Options and check Rows because you want to split your email address into separate rows instead of separate columns. Now, click OK.

How to Clean Up and Import Data Using Power Query in Excel

This works well—the email address has been split into separate lines, and Power Query uses semicolon separators to determine when an email ends and when the next email begins.

How to Clean Up and Import Data Using Power Query in Excel

Note that the Query Settings pane on the right side of the screen records each step you perform. If you get it wrong, just delete the relevant steps and return to your previous location!

After double-clicking on the column title and typing an email address, you need to extract the first (or title) and last name into a separate column. There are multiple ways to do this, but the best way is to right-click on the column header and select "Add Columns by Example".

How to Clean Up and Import Data Using Power Query in Excel

Now, since the first name in my list is Captain, I will type it into the column that appears on the right side of my screen and press Enter. Look! The Power Query Editor recognizes one pattern and suggests the remaining names to complete my columns. After checking that you are satisfied with the suggestions, click OK.

How to Clean Up and Import Data Using Power Query in Excel

Then, perform the same process for the last name and rename the column title in the Power Query Editor.

How to Clean Up and Import Data Using Power Query in Excel

You can now reorder the columns by clicking and dragging them. In my case, I want the email address column to be on the right side of the name.

How to Clean Up and Import Data Using Power Query in Excel

Name this new table in the Query Settings pane before loading it to your spreadsheet.

How to Clean Up and Import Data Using Power Query in Excel

Now, click the Close and Load drop-down menu in the ribbon and select Close and Load to.

How to Clean Up and Import Data Using Power Query in Excel

In my case, I want it to load as a table into cell A4 in an existing worksheet, so before clicking OK, these are the ones I will select in the Import Data dialog box Options.

To select the cell that the table will place, place the cursor in the field box marked "3" in the screenshot below, and select the cell with the mouse.

How to Clean Up and Import Data Using Power Query in Excel

If you need to make any changes to the table, I can double-click the query in the Query and Connect pane.

How to Clean Up and Import Data Using Power Query in Excel

Similarly, if I modify the original list copied from Outlook (such as adding another email address), I can update my Power Query table by right-clicking anywhere in the table and clicking Refresh.

How to Clean Up and Import Data Using Power Query in Excel

Import and reorganize data using Power Query

Power Query can also be used to import data from various locations, such as PDFs or websites. In this example, I'll show you how to import and manipulate data from another spreadsheet, which is especially useful if you want to extract very specific arrays of data from a large dataset, or if you want to reorganize how the data is laid out .

As with the example above, I'll show you a very simple example of doing this with Power Query, which you can then use to use the tool.

First, open the Data tab, and click Get Data>From File>From Excel Workbook.

How to Clean Up and Import Data Using Power Query in Excel

Then, use the Import Data window to find the file from which you want to import data and click Import. This launches the Navigator window, which previews the data you can import from the specified spreadsheet. In my example, I'll click "Sheet 1", which is where the data I want to import is located and then click "Convert Data".

How to Clean Up and Import Data Using Power Query in Excel

In the loaded Power Query editor, I can immediately click "Save and Load" in the upper left corner, but before doing so, some changes are needed.

First, I need to promote my first row to the column header so that the first row of the spreadsheet becomes the first row of data. Conveniently, there is a button that does this immediately: Use the first line as the title, located in the Convert group on the Start tab.

How to Clean Up and Import Data Using Power Query in Excel

Secondly, I want a new row of data for each store and every month so that I can analyze them separately. Currently, my first two columns are fine, so I can select them by holding down the Ctrl key while clicking on each column header. I will then right-click on either column title and click Cancel Perspective Other Columns.

How to Clean Up and Import Data Using Power Query in Excel

Now, each store has its own line every month.

How to Clean Up and Import Data Using Power Query in Excel

Finally, before I load it into the spreadsheet, I need to organize my column headers. If you want to do the same, double-click any title to rename them and click the symbol to the left of each column header to define the data type. This forces Power Query to tag any issues in the data, such as a cell in the Month column does not contain a month.

How to Clean Up and Import Data Using Power Query in Excel

Now, after you name your table in the Query Settings pane (to the right of the Power Query window), click Close and Load > Close and Load to, and select the one you want the table to display Location.

How to Clean Up and Import Data Using Power Query in Excel

Remember that a key benefit of using Power Query compared to simply copying and pasting data is that if the source data changes, you can update the data you reprocessed in a new spreadsheet. To make sure you have the latest version of the data, just right-click on the new table and click Refresh.

How to Clean Up and Import Data Using Power Query in Excel


You can also import tables from the web using Power Query. For example, you might want to import a league standings that may change every weekend, so instead of manually copying and pasting data and making the league standings out of date quickly, use Power Query to help you make sure you have the latest version of data.

The above is the detailed content of How to Clean Up and Import Data Using Power Query in Excel. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to Create a Timeline Filter in Excel How to Create a Timeline Filter in Excel Apr 03, 2025 am 03:51 AM

In Excel, using the timeline filter can display data by time period more efficiently, which is more convenient than using the filter button. The Timeline is a dynamic filtering option that allows you to quickly display data for a single date, month, quarter, or year. Step 1: Convert data to pivot table First, convert the original Excel data into a pivot table. Select any cell in the data table (formatted or not) and click PivotTable on the Insert tab of the ribbon. Related: How to Create Pivot Tables in Microsoft Excel Don't be intimidated by the pivot table! We will teach you basic skills that you can master in minutes. Related Articles In the dialog box, make sure the entire data range is selected (

If You Don't Rename Tables in Excel, Today's the Day to Start If You Don't Rename Tables in Excel, Today's the Day to Start Apr 15, 2025 am 12:58 AM

Quick link Why should tables be named in Excel How to name a table in Excel Excel table naming rules and techniques By default, tables in Excel are named Table1, Table2, Table3, and so on. However, you don't have to stick to these tags. In fact, it would be better if you don't! In this quick guide, I will explain why you should always rename tables in Excel and show you how to do this. Why should tables be named in Excel While it may take some time to develop the habit of naming tables in Excel (if you don't usually do this), the following reasons illustrate today

You Need to Know What the Hash Sign Does in Excel Formulas You Need to Know What the Hash Sign Does in Excel Formulas Apr 08, 2025 am 12:55 AM

Excel Overflow Range Operator (#) enables formulas to be automatically adjusted to accommodate changes in overflow range size. This feature is only available for Microsoft 365 Excel for Windows or Mac. Common functions such as UNIQUE, COUNTIF, and SORTBY can be used in conjunction with overflow range operators to generate dynamic sortable lists. The pound sign (#) in the Excel formula is also called the overflow range operator, which instructs the program to consider all results in the overflow range. Therefore, even if the overflow range increases or decreases, the formula containing # will automatically reflect this change. How to list and sort unique values ​​in Microsoft Excel

How to Format a Spilled Array in Excel How to Format a Spilled Array in Excel Apr 10, 2025 pm 12:01 PM

Use formula conditional formatting to handle overflow arrays in Excel Direct formatting of overflow arrays in Excel can cause problems, especially when the data shape or size changes. Formula-based conditional formatting rules allow automatic formatting to be adjusted when data parameters change. Adding a dollar sign ($) before a column reference applies a rule to all rows in the data. In Excel, you can apply direct formatting to the values ​​or background of a cell to make the spreadsheet easier to read. However, when an Excel formula returns a set of values ​​(called overflow arrays), applying direct formatting will cause problems if the size or shape of the data changes. Suppose you have this spreadsheet with overflow results from the PIVOTBY formula,

How to change Excel table styles and remove table formatting How to change Excel table styles and remove table formatting Apr 19, 2025 am 11:45 AM

This tutorial shows you how to quickly apply, modify, and remove Excel table styles while preserving all table functionalities. Want to make your Excel tables look exactly how you want? Read on! After creating an Excel table, the first step is usual

How to Use the PIVOTBY Function in Excel How to Use the PIVOTBY Function in Excel Apr 11, 2025 am 12:56 AM

Quick Links The PIVOTBY Syntax

Excel MATCH function with formula examples Excel MATCH function with formula examples Apr 15, 2025 am 11:21 AM

This tutorial explains how to use MATCH function in Excel with formula examples. It also shows how to improve your lookup formulas by a making dynamic formula with VLOOKUP and MATCH. In Microsoft Excel, there are many different lookup/ref

How to Use Excel's AGGREGATE Function to Refine Calculations How to Use Excel's AGGREGATE Function to Refine Calculations Apr 12, 2025 am 12:54 AM

Quick Links The AGGREGATE Syntax

See all articles