← Blog / Advanced

Excel Power Query — Automate Data Transformation

If you're still manually cleaning and reshaping data every week or month, Power Query will change your life. It's a built-in ETL (Extract, Transform, Load) tool in Excel that lets you automate repetitive data preparation — once you set it up, it runs with a single click.

What Is Power Query?

Power Query (found under the Data tab as "Get & Transform Data") is a data connection and transformation engine. It can:

  • Import data from files, databases, web pages, APIs, and more
  • Clean and reshape data with a visual, step-by-step interface
  • Merge and append data from multiple sources
  • Automate the entire process — refresh with one click

Getting Started

Importing Data

Go to Data → Get Data. You can import from:

  • Files — Excel, CSV, XML, JSON, PDF, and more
  • Databases — SQL Server, Access, MySQL, PostgreSQL
  • Online — SharePoint, web pages, OData feeds
  • Other — Folder (import all files in a folder), ODBC connections

The Power Query Editor

When you import data, the Power Query Editor opens. This is where you build your transformation steps. Every action you take is recorded as a step that can be replayed:

  1. Remove unwanted columns
  2. Filter rows
  3. Change data types
  4. Split or merge columns
  5. Add calculated columns
  6. Pivot or unpivot data
  7. Group and aggregate

Practical Example: Monthly Sales Report

Suppose you receive a CSV sales report every month and need to clean it the same way each time:

  1. Go to Data → From Text/CSV, select your file
  2. In Power Query Editor, apply your cleaning steps:
    • Remove the first 3 header rows
    • Promote the 4th row to headers
    • Remove blank rows
    • Change "Revenue" column to currency type
    • Add a "Month" column extracted from the date
  3. Click Close & Load to load the clean data into your worksheet

Next month, simply replace the CSV file and click Data → Refresh All. All your cleaning steps run automatically on the new data.

Key Transformations

TransformationWhere to Find ItUse Case
Remove ColumnsRight-click column headerDrop unnecessary fields
Filter RowsDropdown on column headerRemove blanks, specific values
Split ColumnTransform → Split ColumnSeparate "City, State" into two columns
UnpivotTransform → Unpivot ColumnsConvert wide tables to tall format
Merge QueriesHome → Merge QueriesJOIN two tables (like VLOOKUP but better)
Append QueriesHome → Append QueriesStack tables on top of each other
Group ByTransform → Group ByAggregate data (sum, count, average)

Merging Data from Multiple Sources

Power Query's Merge feature is like a database JOIN. Import two tables, then:

  1. Go to Home → Merge Queries
  2. Select the matching columns from each table
  3. Choose the join type (Left, Right, Inner, Full, Anti)
  4. Expand the columns you want from the second table

This is far more reliable than VLOOKUP for large datasets and multiple match columns.

Importing All Files from a Folder

One of Power Query's killer features. If you have monthly reports in a folder:

  1. Data → Get Data → From File → From Folder
  2. Select the folder
  3. Power Query shows all files — click "Combine & Transform"
  4. Apply your cleaning steps once — they apply to every file
  5. When you add new files to the folder, just click Refresh

When to Use Power Query vs Formulas

  • Power Query: Recurring data imports, multi-source data, complex reshaping, large datasets
  • Formulas: One-time calculations, real-time updates as you type, simple transformations

Power Query is a preparation tool — it gets your data ready. Formulas and pivot tables are analysis tools — they help you understand the prepared data.

Want to master Excel with AI?

My upcoming Complete Excel Guide with AI Integration course covers everything from formulas to AI-powered workflows.

Explore Courses