Table Of Contents
Power Query Tutorial
Last Updated :
-
Blog Author :
Edited by :
Reviewed by :
How to Work with Power Query?
Working with Excel Power Query is just fun because of its user-friendly options. It has so many features that we will try to give some examples.
Example - Import Data from Text File
Getting the data from a text file is common. A delimiter value separates each column. For example, look at the below data table.
We will use a Power Query to import this data and transform it into a format that Excel loves working with.
- Go to the "Data" tab, and under "Get Data," click on "From File." Under this, click on “From Text / CSV.”
- Now, it will ask you to choose the file you would like to import, so choose the file and click on “OK.”
- It will display the data preview before it loads to the Power Query model. It looks like this.
As you can see above, it has automatically detected the delimiter as a “Comma” and segregated the data into multiple columns. - Click “Load” at the bottom, which will load data to an Excel file in Excel table format.
On the right side, we have a window called “Queries & Connections,” which suggests that data is imported through a Power Query. - Once the data is loaded to Excel, the connected text file should be intact Excel. So, go to the “Text File Data” and add two extra data lines.
- Now, come to Excel and select the table. It will show two more tabs: "Query” and “Table Design.”
- Under “Query,” click on the “Refresh” button. It will refresh data with updated two new rows.
- There is another problem here, i.e., the first row is not captured as a column header.
- Click “Edit” under the “Query” tab to apply these changes.
- It will open the "Power Query Editor" tab.
It is where we need a Power Query. - To make the first row a header, under the "Home" tab, click “Use First Row as Header.”
- So, this will make the first row a column header. We can see this below.
- Click “Close & Load” under the "Home" tab. It will return data to Excel with modified changes.
- Now in excel, we have data like this.
Without changing the actual position of the data, the Power Query modified the data.
Introduction to Power Query Window
When you look at the Power Query window, you must be confused. So, let us introduce you to the Power Query window.
- Ribbon - This is just like our MS Excel ribbons. Under each ribbon, we have several features to work with.
- List of Queries - This is all the tables imported to Excel in this workbook.
- Formula Bar - This is like our formula bar in Excel, but here it is M Code.
- Data Preview - This is the preview of the data of the selected query table.
- Properties - It is the properties of the selected table.
- Applied Steps - The most important. All the applied steps in the Power Query are displayed here. We can undo actions by deleting the queries.
It is the introductory tutorial to the Excel Power Query model. We have many other things to do with Power Query and will see those in the coming articles.
Things to Remember
- The Power Query is an add-in for Excel 2010 and 2013, so we must install it manually.
- In Excel 2016, the Power Query is under the "Data" tab in the "Get Data" tab, which is in the "Get & Transform Data" section.
Recommended Articles
This article is a guide to Excel Power Query Tutorial. Here, we discuss a step-by-step guide to working with Power Query, along with examples. You can learn more about Excel from the following articles: -