Power Query is Microsoft's data preparation engine: it connects to sources, cleans and reshapes data, and loads the result into Excel or Power BI, where each refresh repeats the same steps automatically. You do not need code to start, but you do need a supported host (Excel for Microsoft 365, Excel 2016 or later on Windows, or Power BI Desktop) and data that sits in a reachable place. The short working path is: open the Power Query Editor from the Data tab, connect to a source, apply transformations, then close and load.
What You'll Need
- A version of Excel that includes Power Query (built in from Excel 2016 onward on Windows; Excel for Microsoft 365 on Mac also includes a version of it, though the editor is more limited than on Windows), or the free Power BI Desktop app.
- A data source you can access: a workbook table, a CSV file, a folder of files, a database, a web page or a cloud service such as SharePoint.
- Permission to read that source. For databases or SharePoint, ask whoever administers it for read access before you begin.
- A little understanding of how your data is laid out, so you know what a clean version should look like.
Note that ribbon labels and menu names can differ slightly between Excel versions, Power BI Desktop releases and regions, so if you do not see an exact button, look for the nearest equivalent in the same tab.
Step-by-Step
- Put your source data somewhere stable. For a workbook source, select the range and turn it into a table (Insert > Table, with My table has headers ticked). Naming the table something meaningful makes it easier to find later. For files on disk, place them in one folder if you plan to combine several.
- Open the Power Query Editor. In Excel, go to the Data tab and choose Get Data (or From Table/Range if the data is already in your sheet). In Power BI Desktop, use Home > Transform data. This opens a separate editor window.
- Connect to your source. Pick the connector that matches where the data lives. For a web page, paste the URL and select the table the preview offers. For a folder, point at the folder and use Combine Files. If you see a credentials prompt, choose the right account type and sign in.
- Check the preview and column types. The editor shows a preview, not the whole dataset. Look at the header row and the type icon at the left of each column name (for example ABC for text, 123 for whole number, a calendar for dates). Correct any wrong type by clicking the icon and choosing the right one, especially for dates and postcodes, which are often mistaken for numbers.
- Remove what you do not need. Right-click a column header and choose Remove, or use Remove Other Columns to keep only what matters. Delete blank top rows with Home > Remove Rows > Remove Top Rows. These small steps make the result faster and cleaner.
- Clean the values. Use Transform > Trim to strip stray spaces, Format to fix capitalisation, and Replace Values for consistent spellings. Split a combined column with Home > Split Column, for instance splitting a full name or a combined date and time, or merge two columns with Add Column > Merge Columns.
- Reshape the table if it is laid out wide. If month names run across the top as separate columns, select those columns and use Transform > Unpivot Columns. That turns a wide, hard-to-chart table into a tall one with a label column and a value column.
- Filter out unwanted rows. Use the arrow on a column header to exclude blanks, headers repeated mid-table, or test rows. Filtering in Power Query removes data permanently from the output, unlike a sheet filter, so be deliberate.
- Name the query. In the Query Settings pane on the right, give the query a clear name. If you are shaping several tables, name each one so the relationship is obvious when you load them.
- Close and load. Choose Home > Close & Load. In Excel this normally creates a new sheet with the result as a table, plus a query in the Queries & Connections pane. In Power BI Desktop, the data appears in the Fields list. Use Close & Load To if you want the result in the data model only rather than on a sheet.
- Review the Applied Steps. The Query Settings pane lists each transformation in order. Click any step to preview the data as it was at that point. This is where you fix mistakes: select a step and delete it, or reorder with the arrows.
- Test a refresh. In Excel, right-click the query in Queries & Connections and choose Refresh; in Power BI, use Home > Refresh. If new rows appear correctly, the query is doing its job on each refresh.
Common Mistakes
- Cleaning data in the sheet instead of the query. Manual edits to the output table are overwritten on refresh. Do the work in the editor so it repeats.
- Trusting the preview row count. The editor loads a sample; a filter that looks right on the sample can behave differently on the full data. Check totals after loading.
- Leaving column types as Any. Untyped columns break date grouping, sorting and calculations later. Set them explicitly.
- Filtering or deleting rows to remove one bad entry. That row is gone for good from the output. If you may need it, filter in the report instead or keep a copy of the raw source.
- Combining files from a folder without checking column headers. If one file has different column names, Combine Files can produce mismatched or null columns. Standardise the source files first.
- Burying the source logic. Hardcoded file paths break when the file moves. Keep source files in a fixed, shared location.
Tips
- Keep your queries small and single-purpose. One query per source, then combine them with merges or appends, is easier to debug than one giant query.
- Use Add Column > Custom Column for simple formulas rather than editing the source. In Excel, Power Query formulas use the M language, not regular Excel functions; for example, converting text to a number uses a different syntax than a worksheet formula.
- Watch the step names. Renaming a step to describe what it does ("Remove duplicate order IDs") saves confusion later when you revisit the query.
- For repeated work, power query lets you copy a query or use a template so the same cleaning steps apply to next month's file.
- Check privacy levels in the query options if you combine sources; mixing sources with different privacy settings can produce errors or force a full refresh.
Troubleshooting
The query fails on refresh. The source has moved, been renamed, or is locked by another user. Right-click the query, open the editor and check the Source step; update the path or close the file that has it open.
Credentials or permission errors. Sign out of the account in the data source settings and sign in again, checking you are using the account that actually has access. For organisation sources, confirm with the administrator that your account was granted read permission.
A column shows nulls or errors. Usually a type mismatch, such as text in a number column or a date in an unexpected format. Select the column, set its type to Text, clean it, then convert back. Right-click a cell with an error to see the message at the bottom of the editor.
Duplicate rows appear after loading. Check whether a combine step or a merge duplicated records. Use Home > Remove Duplicates on the key column, or fix the join so only the intended rows match.
Rows are missing. Look at each applied step in turn and check where the count drops. A filter placed before a type change can silently drop rows that later became clean.
Nothing happens on refresh. Confirm the query is actually set to refresh, and that the workbook or report is connected to the source rather than holding an old cached copy. Close and reopen the file, then refresh again before assuming the query is broken.
Frequently Asked Questions
Is Power Query available in every version of Excel?
It is built into Excel 2016 and later on Windows and into Excel for Microsoft 365 on Mac, with fewer editor features on Mac. Older versions may need the free add-in from Microsoft. If you use Excel on the web, most transformation work needs the desktop app.
Does Power Query change my original data?
No. It reads the source and builds a new output. Your source file or database stays as it was, and you can always reopen the editor to adjust the steps.
Do I need to learn code?
No. The editor records what you click and turns it into a script for you. The Advanced Editor lets you hand-edit that script if you want, but it is optional.
What is the difference between Power Query and a pivot table?
Power Query cleans and prepares data before analysis. A pivot table summarises data that is already clean. In practice you use one after the other: query first, then pivot or chart the result.
Whose data can I connect to?
Only sources you are authorised to access. For databases, SharePoint sites or company files, get permission from the owner first. For data involving other people, remember that privacy and recording rules vary by location.