Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Brinki
Frequent Visitor

Power Query get columns

Any idea how I can get the name & date modified columns with power query?

 

Advanced Editor_1.pngAdvanced Editor.png

9 REPLIES 9
v-tsaipranay
Community Support
Community Support

Hi @Brinki ,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

 

v-tsaipranay
Community Support
Community Support

Hi @Brinki ,

 

I wanted to follow up on our previous suggestions. We would like to hear back from you to ensure we can assist you further.

 

Thank you.

v-tsaipranay
Community Support
Community Support

Hi @Brinki ,

 

I wanted to follow up on our previous suggestions. We would like to hear back from you to ensure we can assist you further.

 

Thank you.

v-tsaipranay
Community Support
Community Support

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:

  1. Retaining only Name, Date modified, and Content columns,
  2. Adding a custom column to parse the binary using Csv.Document,
  3. 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.

grazitti_sapna
Super User
Super User

Hi @Brinki 
Please try the below query:

let
// 1. Connect to SharePoint
Source = SharePoint.Files("https://your-site.sharepoint.com/sites/your-site-name", [ApiVersion = 15]),

// 2. Filter to specific folder
FilteredFiles = Table.SelectRows(Source, each Text.Contains([Folder Path], "Shared Documents/FolderName/")),

// 3. Keep only relevant columns
SelectedColumns = Table.SelectColumns(FilteredFiles, {"Name", "Date modified", "Content"}),

// 4. Add a column to parse CSV and promote headers
AddTables = Table.AddColumn(SelectedColumns, "Data", each try Table.PromoteHeaders(Csv.Document([Content], [Delimiter=","])) otherwise null),

// 5. Remove original binary Content column (optional)
RemovedContent = Table.RemoveColumns(AddTables, {"Content"}),

// 6. Expand the nested data tables
ExpandedData = Table.ExpandTableColumn(RemovedContent, "Data", {"Column1", "Column2", "Column3"}), // Replace with your actual column names

// 7. Optional: Reorder or format columns
FinalTable = Table.SelectColumns(ExpandedData, {"Name", "Date modified", "Column1", "Column2", "Column3"}) // Customize as needed
in
FinalTable



 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

MasonMA
Impactful Individual
Impactful Individual

@Brinki

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

  1. Click the Add Column tab
  2. Choose Custom Column
  3. Name it: Data
  4. 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

  1. In the main query, click the expand icon beside the Data column

  2. Select the columns you want to import (from your CSV conten)

danextian
Super User
Super User

Hi @Brinki 

The other columns should still be available even if you expanded Content.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
lbendlin
Super User
Super User

Do you really want these?  The data in those columns would then be replicated in all rows of the expanded CSV files. Depending on the number of rows in each file that can add up (although in fairness these columns will compress very well in Vertipaq) 

Daniel29195
Super User
Super User

@Hello Brinki, 

 

do you like removing all the columns except for these 2 columns ? if that so, simply click on shift or ctrl cant remember which one, and select with your mouse on the column name and date modified. 

then right click on one of these 2 columns,  --> remove other columns . 

 

 

 

let me know if this is what you want. if not ,feel free to reply to my respond. 

 

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.