Invoke reusable ingestion
Apply the same transformation to every approved input
ETL means extract, transform and load. When two files share a contract, define one function to parse them instead of maintaining separate copies of the same steps. The Power Query Combine Files workflow uses an exemplar query and a function that receives each file binary. Select a representative sample, but verify every file independently: a valid sample is not proof that later files share its schema. Keep a source label on every output row. All snippets are standalone M expressions for a blank query in a disposable Desktop Import environment unless otherwise noted. Outputs are expected, not observed; native M execution and installed build are NOT RUN. Use the inline synthetic inputs; no external account, connection or folder permission is required.
Example 1: invoke a function on two inline CSV files
let Clean = (raw as text, label as text) as table => let Parsed = Csv.Document(raw, [Delimiter=",", Encoding=65001]), Headers = Table.PromoteHeaders(Parsed), Typed = Table.TransformColumnTypes(Headers, {{"ID", type text}, {"Qty", Int64.Type}}, "en-US"), Tagged = Table.AddColumn(Typed, "Source", each label, type text) in Tagged, Files = {[Name="jan.csv", Raw="ID,Qty#(lf)001,2"], [Name="feb.csv", Raw="ID,Qty#(lf)002,5"]}, Parts = List.Transform(Files, each Clean([Raw], [Name])), Combined = Table.Combine(Parts)in CombinedExpected two rows, 001/2/jan.csv and 002/5/feb.csv; total Qty 7. This example assumes the approved exact headers and valid integers. Csv.Document can take text or binary; the text inputs here model the contents of files, not paths. Table.PromoteHeaders uses the first row for names. A separate query may hold Clean as a function instead of nesting it in let. Do not promote headers twice.
Example 2: keep a per-file audit
let Inputs = {[Name="jan.csv", Data=#table({"Qty"},{{2},{3}})], [Name="feb.csv", Data=#table({"Qty"},{{5}})]}, Summarize = (f as record) as record => [Source=f[Name], Rows=Table.RowCount(f[Data]), Units=List.Sum(f[Data][Qty])], Audit = Table.FromRecords(List.Transform(Inputs, each Summarize(_)))in AuditExpected audit: jan.csv has 2 rows and 5 units; feb.csv has 1 row and 5 units. Reconcile against the combined table: 3 rows and 10 units. This is a logical audit, not an exactly-once execution log; refresh can reevaluate queries. For an empty input, decide whether the subtotal should display null or zero before interpreting List.Sum.
Move from inline inputs to approved folders
In a separately approved local environment, point the Folder connector at a dedicated lab folder, then filter the returned file listing to the exact approved names and expected extension before invoking the transformation. Folder listings can include subfolders or hidden files, so an extension filter alone is not a trust boundary. Do not open arbitrary files or derive paths from CSV cells. Invoke against the Content binary already provided by the connector. Preserve the original inputs and record source identity, counts, rejects and duplicate business keys. The GUI may generate helper queries; check the sample transform and the combined output. Service refresh and gateway configuration require independent authorization and testing.
Practice: add a file
In example one, append a third approved record with name mar.csv and text ID,Qty followed by a newline and 003,4. Predict combined row count, total Qty and the source of ID 003. Describe how to detect the same ID appearing in another file.
Official reading
combine · csv-combine · functions · csv · addcolumn