hello @Anonymous
You can do this with a Function.
beware - you need to separate your Extract / Load queries, so that you don't trigger the formula firewall.
Here's my example in Excel using Power Query (Dataflows method will work in the same or a very similar way)

Get Headers function - returns the Extract Headers query table

Extract Headers query - extracts your header data

Extract Data query - extracts your data data
Load Header query - references the extract header query
Load Data query - references the extract data query
Transform Data query - references the load data query, and calls the get headers function.

i hope this helps.
workbook attached