Replace text in a SharePoint File [Word document] using Power Automate

Johanna Lorenz 0 Reputation points
2025-06-26T08:03:12.2733333+00:00

Hello

Any help will be appreciated!

I have an issue: I wanted to replace the text in a Word document present in the SharePoint document library. I was getting a file from the SharePoint document library. Get file returns the content in binary data type. I want the content to be in text format so that I can easily replace it.  To convert the binary data output, I used Compose with the expression: @{base64ToString(body('Get_file_content')?['$content'])}. 

Compose 1: @{replace(outputs('Compose'),' Invoice Number', 'Invoice ID')} then updating the file content of Update File with Compose 1 outputs. but it's not working. not replacing the text. Is there any other way to do it? Please suggest a solution for me.
How to do this? Is there any way to use the GRAPH API or REST API in Power Automate?
Thank you!

User's image

User's image

User's image

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.