Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hi all,
I need help dynamically pulling headers when importing data via API in PowerQuery. I'm currently entering headers manually, which is terribly inefficient and requires manual updates whenever new fields are added to the API.
Here's what I have:
let
endpoint = "(REST API endpoint URL)",
directive= "A",
cache = "false",
command = Record.FromList({keys}) ,
headers = Record.FromList({command},{"Headers"}),
payload = Json.Document(Web.Contents(endpoint, headers)),
value = payload[value],
#"Converted to Table" = Table.FromList(value, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {
"Header 1",
"Header 2",
"Header 3"
})
in
#"Expanded Column1"In this query's current state, only the identified headers ("Header 1", "Header 2", "Header 3") are pulled into the table.
What I'd rather say is, "Give me every column from all headers available." That way, when I refresh the dataset, any new columns will be pulled dynamically.
Any help would be appreciated. Thanks!
Solved! Go to Solution.
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", Headers)
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", Headers)
It worked. Thanks so much!
I have a question. How did you define key?
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
| User | Count |
|---|---|
| 16 | |
| 9 | |
| 8 | |
| 7 | |
| 7 |