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

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

πŸ“Ž This article includes 3 downloadable practice files ↓

⏱ 2 min read

πŸ“˜ Power Query Intermediate Course Β· Lesson 1 of 8

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

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.

Advertisement

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.

Advertisement

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.

✨ 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 Comment