How to Get Comments from a Word DOCX Document in Power Automate
Adding comments to a DOCX draft is an efficient and useful aspect of modern content collaboration processes. Those with a shared stake in any written project can simply highlight content within a DOCX file, initialize a comment, and quickly broadcast their thoughts to an entire team of collaborators with just a few clicks.
There’s even more we can do with DOCX comments, however. In Power Automate, we can extract the entire Comments array from a DOCX file and utilize the text content & other comment metadata dynamically in a programmatic workflow. We can streamline the way we analyze and review feedback, and we can populate other tools in our system (e.g., a SharePoint List) with comment content directly.
To extract comments from our documents in Power Automate, we can use the Cloudmersive Document Conversion connector. We can use an action that returns each comment to our flow hierarchically (in the order they appear within the document), and in doing so, we’ll gain access to dynamic information including the comment author, text, date, path, and more.
In this article, we’ll run through a quick Instant cloud flow that demonstrates setting up our Document Conversion connector action to extract DOCX comments. In my example flow, I’ll use a Lorem Ipsum document with several comments included.
We’ll begin by retrieving our example document from our system. I’m retrieving my example document from a OneDrive for Business folder, so I’ll be using the OneDrive for Business iteration of a Get file content action.
Next, we’ll find the action we’ll use to get our DOCX comments.
To do that, we’ll add a new action and type “Cloudmersive” into the search bar. We’ll scroll down the list of Cloudmersive connectors until we find the Document Conversion option, which has a green logo.
To view the entire actions list, we’ll click on the “See more” link to the right of the connector title.
From there, we’ll CTRL+F search for an action called Get comments from a Word DOCX document hierarchically.
When we select this action, we’ll need to create our Cloudmersive Document Conversion connection. That requires an API key, which we can get for free by creating a free account on the Cloudmersive website.
Once our connection is created and authorized, we’ll click “Show all” to view both of our advanced parameters.
Since we’re performing a GET request, our job is simple — we just need to enter dynamic content from our Get file content action in the ReqConfig/InputFileBytes parameter.
If we now open any random action — like a Condition control, as I’ve used in my example — we’ll be able to view dynamic response content from our Get comments action.
We can use any of our document’s comment information — including the text runs and all the metadata we see here — to influence subsequent actions in our flow.
In my example flow, I’ll simply delete the Condition and run the flow as it is to review the raw outputs.
In the raw outputs of our Get comments action, we’ll find a Comments array containing information about each comment in our DOCX document in the order the comments appeared within the original file. In my example, we can see the first comment in my example document had a reply comment, and that reply is nested underneath the original comment.
Just like that, we can now use DOCX comment information dynamically for any purpose we see fit.