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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ValeriaBreve
Post Patron
Post Patron

Retrieve Excel file comment property in PowerBI

Hi,

I have a few Excel files on a Sharepoint. I have added some comments to their properties:

 

ValeriaBreve_0-1656417065520.png

Is there a way I can retrieve this property when importing the file in PowerBI?

Thank you very much!

Kind regards

Valeria

 

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @ValeriaBreve ,

 

Rather than doing what is described in that article, I would encourage you to create a separate Excel sheet (or SharePoint list, etc.) to store your comments along with a key column that you can use to merge into your table that is refreshing. That way you comments are never lost, and you can update them as needed.

 

If you add comments to the SharePoint Online list, then please use the API to get it according to this document.

GET SharePoint list item comments using REST API 

 

The sample code in Power Query is as follows:

let
    Source = Xml.Tables(Web.Contents("https://<tenant>.sharepoint.com/sites/<site>/_api/web/lists/getbytitle('<list-name>')/items(<item-id>)/Comments()")),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"id", type text}, {"updated", type datetime}}),
    #"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"entry"}),
    #"Expanded entry" = Table.ExpandTableColumn(#"Removed Other Columns", "entry", {"content"}, {"entry.content"}),
    #"Expanded entry.content" = Table.ExpandTableColumn(#"Expanded entry", "entry.content", {"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"}, {"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"}),
    #"Expanded http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" = Table.ExpandTableColumn(#"Expanded entry.content", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata", {"properties"}, {"properties"}),
    #"Expanded properties" = Table.ExpandTableColumn(#"Expanded http://schemas.microsoft.com/ado/2007/08/dataservices/metadata", "properties", {"http://schemas.microsoft.com/ado/2007/08/dataservices"}, {"http://schemas.microsoft.com/ado/2007/08/dataservices"}),
    #"Expanded http://schemas.microsoft.com/ado/2007/08/dataservices" = Table.ExpandTableColumn(#"Expanded properties", "http://schemas.microsoft.com/ado/2007/08/dataservices", {"itemId", "text"}, {"itemId", "text"}),
    #"Expanded itemId" = Table.ExpandTableColumn(#"Expanded http://schemas.microsoft.com/ado/2007/08/dataservices", "itemId", {"Element:Text"}, {"Element:Text"})
in
    #"Expanded itemId"

vkkfmsft_0-1656642464276.png


If you create another table which saves your comments, please refer to this thread.

https://community.powerbi.com/t5/Power-Query/Excel-file-where-comments-are-linked/m-p/2090816#M61586 

 

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
ValeriaBreve
Post Patron
Post Patron

Hi! Thank you very much for your reply! I have thought of an Excel spreadsheet, I just wanted to avoid to have another file to maintain.

I don't think it's the same comments that the article is talking about - it is referring to comments on the Sharepoint list, I have put my comments in the file details (right click on the file --> Properties --> Details Tab). I can see them only with file explorer, if I add the "Comments" field for display.

ValeriaBreve_0-1656653421602.png

ValeriaBreve_1-1656653643271.png

Thanks

Kind regards

Valeria

Hi @ValeriaBreve ,

 

I understand your idea, I have made an attempt, but I can't get the comments in the excel file properties. So I had to change my mind and add the comments to the SharePoint Online list or maintain a table for the comments.

 

vkkfmsft_0-1657086671416.png

 

Best Regards,
Winniz

v-kkf-msft
Community Support
Community Support

Hi @ValeriaBreve ,

 

Rather than doing what is described in that article, I would encourage you to create a separate Excel sheet (or SharePoint list, etc.) to store your comments along with a key column that you can use to merge into your table that is refreshing. That way you comments are never lost, and you can update them as needed.

 

If you add comments to the SharePoint Online list, then please use the API to get it according to this document.

GET SharePoint list item comments using REST API 

 

The sample code in Power Query is as follows:

let
    Source = Xml.Tables(Web.Contents("https://<tenant>.sharepoint.com/sites/<site>/_api/web/lists/getbytitle('<list-name>')/items(<item-id>)/Comments()")),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"id", type text}, {"updated", type datetime}}),
    #"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"entry"}),
    #"Expanded entry" = Table.ExpandTableColumn(#"Removed Other Columns", "entry", {"content"}, {"entry.content"}),
    #"Expanded entry.content" = Table.ExpandTableColumn(#"Expanded entry", "entry.content", {"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"}, {"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"}),
    #"Expanded http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" = Table.ExpandTableColumn(#"Expanded entry.content", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata", {"properties"}, {"properties"}),
    #"Expanded properties" = Table.ExpandTableColumn(#"Expanded http://schemas.microsoft.com/ado/2007/08/dataservices/metadata", "properties", {"http://schemas.microsoft.com/ado/2007/08/dataservices"}, {"http://schemas.microsoft.com/ado/2007/08/dataservices"}),
    #"Expanded http://schemas.microsoft.com/ado/2007/08/dataservices" = Table.ExpandTableColumn(#"Expanded properties", "http://schemas.microsoft.com/ado/2007/08/dataservices", {"itemId", "text"}, {"itemId", "text"}),
    #"Expanded itemId" = Table.ExpandTableColumn(#"Expanded http://schemas.microsoft.com/ado/2007/08/dataservices", "itemId", {"Element:Text"}, {"Element:Text"})
in
    #"Expanded itemId"

vkkfmsft_0-1656642464276.png


If you create another table which saves your comments, please refer to this thread.

https://community.powerbi.com/t5/Power-Query/Excel-file-where-comments-are-linked/m-p/2090816#M61586 

 

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors