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
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!