Forum Discussion
Get and Transform Excel files from SharePoint list
- 4 years ago
Thanks Edhans for your advice.
Luckily I was able to figure out how to achive my goal within Power BI.
Here is how to read the SharePoint list, extract attachments and combine them into one big table:
Top:
let Source = SharePoint.Contents("https://company.sharepoint.com/sites/SiteName/", [ApiVersion = 15]), Lists = Source{[Name = "Lists"]}[Content], #"Your Reports1" = Lists{[Name = "Your SP List"]}[Content], Attachments = #"Your Reports1"{[Name = "Attachments"]}[Content],After this step, we have a column called "Content" that contains Table information of attachments.
Then use: Table.ExpandTableColumn to expand that table, give us the Content.Content with type Binary.
Then use: Table.ExpandTableColumn again on "Content.Content", give us "Data" column of each attachment
Then use: Table.ExpandTableColumn again on "Data" column to get combined table of data.
Along the way, Power BI generates "Transform File" "Sample File" functions automaticly.
Cheers!
Md
Thanks Edhans for your advice.
Luckily I was able to figure out how to achive my goal within Power BI.
Here is how to read the SharePoint list, extract attachments and combine them into one big table:
Top:
let
Source = SharePoint.Contents("https://company.sharepoint.com/sites/SiteName/", [ApiVersion = 15]),
Lists = Source{[Name = "Lists"]}[Content],
#"Your Reports1" = Lists{[Name = "Your SP List"]}[Content],
Attachments = #"Your Reports1"{[Name = "Attachments"]}[Content],
After this step, we have a column called "Content" that contains Table information of attachments.
Then use: Table.ExpandTableColumn to expand that table, give us the Content.Content with type Binary.
Then use: Table.ExpandTableColumn again on "Content.Content", give us "Data" column of each attachment
Then use: Table.ExpandTableColumn again on "Data" column to get combined table of data.
Along the way, Power BI generates "Transform File" "Sample File" functions automaticly.
Cheers!
Md