Forum Discussion
Power Query get columns
- 1 year ago
From UI, you may follow these steps,
1. To keep only needed columns, select the columns: 'Content', 'Name', 'Date modified', right-click and choose Remove Other Columns
2. Import file content
- Click the Add Column tab
- Choose Custom Column
- Name it: Data
- Use this formula:
Csv.Document([Content], [Delimiter=";"])3. Promote headers by clicking Use First Row as Headers on the top ribbon
4. Expand nested table
In the main query, click the expand icon beside the Data column
Select the columns you want to import (from your CSV conten)
Hi Brinki ,
Thank you for reaching out to the Microsoft Fabric Community Forum.
If you're importing files (e.g., CSVs from SharePoint or a folder), and you want to retain file-level metadata such as Name and Date modified while expanding the file content in Power Query, the approach shared by grazitti_sapna using M code is fully accurate and effective. It ensures:
-
The binary content is processed with Csv.Document, keeping the file metadata, which is then combined with the tabular data. The final result provides the necessary columns, with the content organized into a structured format.
Alternatively, as demonstrated by MasonMA , the same can be achieved through the Power Query UI by:
- Retaining only Name, Date modified, and Content columns,
- Adding a custom column to parse the binary using Csv.Document,
- Promoting headers and expanding the resulting tables.
As noted by danextian , metadata columns remain available even after expansion, and lbendlin rightly points out that although metadata is repeated for each row post-expansion, Power BI’s compression engine typically handles it efficiently.
Both the script-based and UI-driven methods provided above will meet your requirement. You can proceed confidently with either, depending on your comfort level with M code or GUI.
I hope this helps resolve your issue. If you need any more assistance, please feel free to reach out.
Thank you.