Power Query Intermediate Lesson 1: Parameters – One Folder Path for Every Query

Power Query Intermediate Lesson 1: Parameters - One Folder Path for Every Query 1

📎 This article includes 3 downloadable practice files ↓

⏱ 2 min read

📘 Power Query Intermediate Course · Lesson 1 of 8

Advertisement
In this article
  1. Option A: a named cell (best for sharing)
  2. Option B: a parameter
  3. Type early
  4. Practice

Every query you build has the full path baked into its Source step. Move the folder, or send the file to a colleague, and every query breaks. Put the path in one place.

Option A: a named cell (best for sharing)

  1. In a sheet, type the folder in a cell, e.g. D:\PQ\, and name the cell FolderPath (Name Box).
  2. In each query’s Advanced Editor, add at the top:
Folder = Excel.CurrentWorkbook(){[Name="FolderPath"]}[Content]{0}[Column1],
Source = Csv.Document(File.Contents(Folder & "invoices.csv"), [Delimiter=",", Encoding=65001]),

A colleague types their own path in the cell and clicks Refresh All.

Option B: a parameter

Home > Manage Parameters > New: name Folder, type Text, current value D:\PQ\. Use Folder & "invoices.csv" in the Source step. Change it any time from Manage Parameters.

⚠️ If Excel complains about “Formula.Firewall”, the query combines the cell (one source) with a file (another). Go to File > Options and Settings > Query Options > Privacy and set the workbook’s privacy level, or ignore privacy levels for files you trust.

Type early

The lesson’s query filters [Date] >= #date(2026, 8, 1). That only works after Table.TransformColumnTypes turns the text into real dates; comparing text dates gives wrong results silently.

Practice

Unzip the source files (e.g. to D:\PQ\). Try to build the query with the ribbon first, then compare with the M solution and the expected result. Every solution was run by Excel’s own Power Query engine before publishing.

📎 Practice files for this article

⬇ Download all 3 files (ZIP · 8 KB)

  • 🗂️
    Practice source files (zip)All messy CSVs for the course: invoices, payments, typed customer names, credit history, contacts, branch files, a two-row-header report and an ERP register.
    ⬇ ZIP · 3 KB
  • 📄
    Lesson 1 M solutionThe full query. Paste into Advanced Editor and change the Folder line.
    ⬇ PQ · 784 B
  • 📗
    Expected resultWhat the query returned when Excel ran it, to compare with yours.
    ⬇ XLSX · 5 KB

Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.

Advertisement
✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong

Leave a Reply

Your email address will not be published. Required fields are marked *