Forum Discussion

madrid's avatar
madrid
Helper I
4 years ago
Solved

Get and Transform Excel files from SharePoint list

Hi there,   I have a SharePoint list for user to update information. Each list item include some data (in list columns) and an attachment excel file (with fixed format, data in first tab of the wo...
  • madrid's avatar
    madrid
    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