Showing results for 
Search instead for 
Did you mean: 
Post Patron
Post Patron

Reading XML Data from Word Document



I have a flow that reads an xml file, that is based on a Word document stored in SharePoint, processes the text from the Word document as a string and stores it within a content control in another Word document. I've had to manipulate the string using the split function and created an array to remove text characters I don't want. This works fine and the rest of the flow does what it needs to do.


However, is there a way to modify the xpath step to capture all of the text in the Word document's XML file including the formatting from the original document?


It has proven to be challenging to get the xml data to display consistently after it's processed as a string and stored in the other Word document content control. The current expression I've been using is below. I've tried replacing the "w:t" with "w:r", "w:body", and "w:color" but I've had no luck. Ultimately, when a new document is created from within my flow, I would like the content control within that document to display with all of the information and formatting from the xml file of the original document. I appreciate any guidance or suggestions.


xpath(xml(outputs('Get_file_content')?['body']), '//*[name()=''w:t'']/text()')
Frequent Visitor

I got this working by using 




Since power automate doesn't support namespaces, it seems you can use the "local-name" and exclude the namespace.

Hope this helps. Spent a lot of time getting this to work for my own project.

Edit: Added "/text()" to the second xpath parameter

Helpful resources

Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (2,309)