Skip to main content

Notifications

Community site session details
Power Automate - Building Flows
Answered

Copying text from Word .docx to Email

Like (0) ShareShare
ReportReport
Posted on 20 May 2022 12:24:57 by 112

Hi all, 

 

I've kind of hit a brick wall and I'm hoping someone can help. 

 

Scenario: We send our customers an e-mail requesting some network information prior to installation, requesting they fill in some basic information. The content of the email/attachment varies depending on the model they are having. 

 

The attachment part i've resolved fairly easily. The sharepoint list that contains the customer info has a calculted field called "attachment link" that dynamically creates the filepath for them to use. 

 

I figured I'd use the same approach to the content of the email, but can't get it to work. 

I have a file for each model with the template for the content held within it. Initially I tried inputting the dynamic content 'File Content' directly into the email, but that isn't given as an option, so I figured I'd run it through the 'Compose' action first to give me an output to work with. 

SimonSmith84_0-1653049581278.png

 

This has worked, but the email generated looks like this: 

SimonSmith84_1-1653049413073.png

 

I'm assuming it's taking all of the XML included in the file content, but I can't see or find an easy way to remove this, and retain the text and (preferably, but not essentially) the formatting as well. 

 

Any hints in the right direction would be gratefully received!

 

 

  • takolota1 Profile Picture
    4,859 Super User 2025 Season 1 on 02 Sep 2023 at 19:15:34
    Re: Copying text from Word .docx to Email

    You could also use the OneDrive action to convert a given word document to a pdf, then use parts of this template to either extract exact data values from the document or just get the entire file contents as a text replica:

    https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Extract-Data-From-PDFs-and-Images-With-GPT/td-p/2201345

  • SimonSmith84 Profile Picture
    112 on 23 May 2022 at 07:29:20
    Re: Copying text from Word .docx to Email

    Thanks both. I managed to find a workaround by saving my word documents as HTML files in the first instance. (They were being used as email templates). 

     

    I've checked out Muhimbi, which looks great, but would never be able to justify the costs of it to the higher ups! I'll take a look at encodian in the near future too. 

  • Verified answer
    Jay-Encodian Profile Picture
    2,920 on 23 May 2022 at 07:24:29
    Re: Copying text from Word .docx to Email

    @SimonSmith84 @CFernandes - The Encodian action also covers this... just change the output of the 'Convert Word' action from 'TXT' to 'HTML'

  • CFernandes Profile Picture
    8,283 Most Valuable Professional on 20 May 2022 at 13:19:40
    Re: Copying text from Word .docx to Email

    Hello @SimonSmith84 

     

    I am using the Muhimbi connector -

     

    CFernandes_0-1653052761996.png

     

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

  • SimonSmith84 Profile Picture
    112 on 20 May 2022 at 13:18:25
    Re: Copying text from Word .docx to Email

    Hey @CFernandes - That looks perfect! Please can you provide the name of the connector? Can't see it when eyeballing steps etc. even with "convert document" in the search field. 

  • CFernandes Profile Picture
    8,283 Most Valuable Professional on 20 May 2022 at 13:07:59
    Re: Copying text from Word .docx to Email

    Hey @SimonSmith84 

     

    Workaround with third party Connector.

     

    CFernandes_0-1653052056027.png

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

     

  • SimonSmith84 Profile Picture
    112 on 20 May 2022 at 12:55:49
    Re: Copying text from Word .docx to Email

     

    @CFernandes :

    Yeah I read that article. My difficulty is the method he uses doesn' work for my particular setup, as my 'Get File Content Path' doesn't offer its output as dynamic content for filtering an array. It is as close as I've come to an answer though. 

     

    @Jay-Encodian - Hi Jay, thanks for this. I was hoping for a solution that allowed me to retain the formatting etc. If it comes to it, I can replace the .docx file with a .txt file anyway and then apply formatting in HTML I guess. I just wanted to try and do it with the word doc first to see if I could retain the formatting. This would allow other users to update the documentation and have the formatting carry over. 

  • CFernandes Profile Picture
    8,283 Most Valuable Professional on 20 May 2022 at 12:49:08
    Re: Copying text from Word .docx to Email

    Hey @SimonSmith84 

     

    Its not that easy 🙂 as Power Automate returns the entire document with encoding\formatting.

     

    You need to try something this - https://www.tachytelic.net/2021/05/power-automate-extract-text-from-word-docx-file/ 

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

  • Jay-Encodian Profile Picture
    2,920 on 20 May 2022 at 12:47:10
    Re: Copying text from Word .docx to Email

    Hey @SimonSmith84 

    You can extract the text from a Word document by converting the document to TXT format using the Encodian connectors 'Convert Word' action, example flow can be found here: https://www.encodian.com/blog/search-word-documents-with-microsoft-power-automate/

    HTH

    Jay

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard
Loading started
Loading started
Loading complete