Power Query course · Lesson 1 of 17

What is Power Query? Where it lives and which version you have

What Power Query is, the problems it solves, where to find it in Excel for Windows, Mac and the web, and how versions differ.

Beginner 14 min read

Most people who work in Excel spend a surprising part of the week not analysing data but preparing it: deleting the three title rows at the top of an export, fixing dates that arrived as text, trimming spaces from customer names, copying twelve monthly files into one sheet. Power Query is the tool inside Excel that turns that preparation into a recorded, repeatable recipe. You do the cleaning once, Power Query writes down every step, and from then on a single click on Refresh repeats the whole recipe on the latest data.

This course takes you from your first query to writing your own M functions. If you have already read the overview lesson Power Query basics: import, clean, append, merge, refresh in the Excel course, you have seen a quick tour of importing, appending and merging. Here we go slower and deeper: each lesson concentrates on one family of transformations, shows the data before and after, and explains the M code that Power Query writes behind the scenes.

The problem Power Query solves

Imagine you are the sales analyst of a small distributor. Every Monday the ERP system emails you weekly_sales.csv. Every Monday you open it, delete the report header, split the Customer / City column, convert the amounts, remove cancelled orders and paste the result under last week's data. It takes forty minutes, and if you are tired you forget one step. With formulas you could automate part of it, but formulas cannot delete rows, cannot open a file by themselves and get slow when they reference hundreds of thousands of cells.

ABCD
1Weekly sales export
2Printed: 2026-03-09
3OrderCustomer / CityStatusAmount
4SO-5512Nordic Foods / OsloShipped1 240,00
5SO-5513Agora Market / AthensCancelled310,50
6SO-5514Baltic Trade / RigaShipped2 015,75

Before: the raw export, with report lines on top, two facts in one column, cancelled orders and amounts stored as text with a space as thousands separator.

ABCD
1OrderCustomerCityAmount
2SO-5512Nordic FoodsOslo1240
3SO-5514Baltic TradeRiga2015.75

After: the same file after a Power Query recipe of five steps. Next week the recipe runs again with one click.

A query built once handles next week's file, and the week after, without you touching the steps. That is the core promise: you describe the transformation, not the result. The result is recalculated from the source every time you refresh.

What Power Query is, in plain words

  • A data connection and transformation engine. It reads data from files, folders, databases, web pages, SharePoint lists and many other sources.
  • A step recorder. Every action you take in its editor (remove a column, filter a row, change a type) is saved as a named step in the Applied Steps list.
  • A language. The steps are stored as code in a language called M (officially the Power Query Formula Language). You can build everything with buttons, but reading M lets you fix and extend queries. You will learn it in The M language: let, steps, lists, records, tables and each.
  • Non-destructive. Power Query never changes the source file. It reads it, transforms a copy in memory, and loads the result to a worksheet table, a PivotTable or the Data Model.
  • Shared with Power BI. Power BI Desktop, Microsoft Fabric dataflows and several other Microsoft products use the same engine and the same M language, so your skills transfer directly.

Power Query versus formulas, macros and Power Pivot

ToolBest atWeak at
FormulasLive calculations on data already in the sheetImporting files, deleting rows, reshaping tables
Power QueryGetting, cleaning, reshaping and combining dataCell-by-cell interactive calculations
VBA macrosAutomating anything in Excel, including formatting and emailsNeeds programming; .xlsm files are often blocked
Power Pivot / Data ModelRelationships and DAX measures over millions of rowsCleaning messy source data

The tools work together. A typical modern workbook uses Power Query to load clean tables, the Data Model to relate them, and a PivotTable or a few formulas such as XLOOKUP or SUMIFS for the final report. Power Query replaces most of the repetitive cleaning macros people used to record, and it works in ordinary .xlsx files, so no macro security warnings appear.

Where Power Query lives in Excel for Windows

In Excel 2016, 2019, 2021, 2024 and Microsoft 365 for Windows, Power Query is built in. It does not carry its own name on the ribbon: Microsoft calls the group Get & Transform Data. You find it on the Data tab, at the left end of the ribbon.

  • Data › Get Data: the full menu of sources, organised as From File, From Database, From Azure, From Power Platform, From Online Services and From Other Sources.
  • Data › From Text/CSV, From Web and From Table/Range: shortcuts to the three most used sources. In some recent Microsoft 365 builds From Table/Range is labelled From Sheet.
  • Data › Recent Sources and Existing Connections: reuse a source you connected to before.
  • Data › Queries & Connections: opens a side pane listing every query in the workbook. Double-click a query there to edit it.
  • Data › Get Data › Launch Power Query Editor: opens the editor directly, even with no query selected.
Note. In Excel 2010 and 2013 Power Query was a free add-in downloaded from Microsoft, with its own Power Query ribbon tab. It is no longer updated. If you still use those versions, the concepts in this course apply, but many newer buttons and M functions are missing. Excel 2016 for Windows introduced the built-in version, first named New Query on the Data tab and renamed Get Data in later updates.

Power Query on the Mac

For many years Mac users could only refresh queries made on Windows. Microsoft 365 for Mac now includes the Power Query editor and a growing list of sources. You open it with Data › Get Data (Power Query), which shows a window of data sources instead of the cascading menu you see on Windows. Local files such as Excel workbooks and Text/CSV are supported, as are tables and ranges in the current workbook and some online sources.

  • The editor looks almost the same as on Windows, with the Home, Transform and Add Column tabs and the Applied Steps list.
  • Fewer connectors are available. Database connectors that rely on Windows drivers, for example ODBC and OLE DB sources, are missing or limited.
  • Excel 2016, 2019 and 2021 for Mac (the one-time purchase versions) have a much older and smaller feature set. If something in this course is missing on your Mac, check that you are on a current Microsoft 365 build.
  • Queries are stored in the workbook, so a file built on Windows opens on a Mac and can usually be refreshed if the source is reachable from the Mac (paths like C:\Data\ will not exist there).

Power Query in Excel for the web

Excel for the web can refresh queries whose sources it can reach, such as tables in the same workbook and some cloud files. Microsoft has been adding the Power Query editor and Data › Get Data to the browser version step by step. Treat the web version as a good place to refresh and make small edits, and the Windows desktop app as the place to build complex queries. A query that points to a file on your local disk cannot be refreshed in the browser, because the browser cannot see your disk.

Tip. Not sure which version you have? In Windows choose File › Account and look under Product Information and About Excel. On a Mac choose Excel › About Excel. If you see Microsoft 365 with a recent version number, you have the latest Power Query.

Your first look: a two-minute query

Let us make a tiny query so the vocabulary of the next lessons is concrete. Type a small HR list into a sheet, with headers Employee, Department, Start date, Salary.

  1. Click any cell inside the list.
  2. Choose Data › From Table/Range (or From Sheet). Excel asks to create a table; keep My table has headers ticked and click OK.
  3. The Power Query Editor window opens. On the right you see Applied Steps with two steps: Source and Changed Type.
  4. Click the Department header, then choose Home › Sort Ascending. A third step, Sorted Rows, appears.
  5. Choose Home › Close & Load. A new sheet opens with a green table holding the sorted result, and the Queries & Connections pane shows the query name and its row count.
  6. Go back to the original list, add a new employee, then choose Data › Refresh All. The new employee appears in the sorted output.

Behind the buttons, Power Query has written this M code. You can see it with Home › Advanced Editor:

Power Query M
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source, {{"Employee", type text}, {"Department", type text}, {"Start date", type date}, {"Salary", Int64.Type}}),
    #"Sorted Rows" = Table.Sort(#"Changed Type", {{"Department", Order.Ascending}})
in
    #"Sorted Rows"
Each line between let and in is one applied step; the name after in is the step whose result is loaded.

Do not worry about the syntax yet. Notice only that each step has a name, that each step uses the previous step's name as its input, and that the last step is the one returned. That chain is the whole idea of Power Query.

Watch out. The output table belongs to the query. If you type into it, your edits disappear at the next refresh. Change the source data or change the query instead.

Vocabulary for the rest of the course

TermMeaning
QueryA named recipe: one source plus a list of steps
Applied StepsThe ordered list of transformations in a query
Power Query EditorThe window where you build and edit queries
MThe language the steps are written in
LoadSending the result to a sheet table, PivotTable or the Data Model
RefreshRe-running every step against the current source data
Connection onlyA query that is not loaded anywhere, used as a building block for others

How this course is organised

Lessons 1 to 6 are for beginners: getting data (Getting data: files, folders, tables, web pages and databases), the editor (The Power Query Editor: steps, formula bar and data types), and the everyday cleaning tools. Lessons 7 to 12 reshape and combine data: unpivot, group, append, merge and combine whole folders. Lessons 13 to 16 open the hood: the M language, parameters and functions, calendar tables and performance. The final lesson, Project: a self-updating monthly sales report, puts everything together in a monthly report that refreshes itself.

Check yourself

1. Where is Power Query on the Excel for Windows ribbon?

2. What happens to the source CSV when you remove rows in a query?

3. What is M?

4. A query points to C:\Data\sales.csv. Where can it NOT be refreshed?

5. You typed corrections into a table loaded by a query. What happens at the next refresh?