Skip to main content

Notifications

Community site session details

Community site session details

Session Id : ZPLq5+HdbYdAK1NUvPIWWU
Power Automate - General Discussion
Suggested answer

How to embed attachments (file) into Word document template using power automate cloud flow?

Like (0) ShareShare
ReportReport
Posted on 12 Dec 2024 16:40:45 by 4

I’m working on a project where I need to embed an attachment file (e.g., a PDF or Excel file) into a Word template as an object, with icon(show icon enabled). I am using Power Automate Cloud Flows for this task.

Does anyone have experience or ideas on how to achieve this? Any guidance, examples, or workaround solutions would be greatly appreciated!

Thank you in advance!

Categories:
  • DP_8958 Profile Picture
    4 on 13 Dec 2024 at 18:05:18
    How to embed attachments (file) into Word document template using power automate cloud flow?
    @Ninjasabi I did get this far with the help of GPT but was not able to understand how to go about using option 2. Can you share a working example of the solution if you have one. Or any blogs/documentations that i can go through to acquire the same
  • Suggested answer
    Ninjasabi Profile Picture
    120 on 13 Dec 2024 at 12:33:18
    How to embed attachments (file) into Word document template using power automate cloud flow?

    Embedding an attachment (e.g., PDF or Excel file) as an object into a Word document using Power Automate Cloud Flow is not natively supported as a direct feature. However, you can use a combination of Power Automate and other tools (like Office Scripts, Word Online, or desktop automation) to achieve this. Here's how you can approach this:


    Solution Options:

    Option 1: Use a Desktop Flow with Power Automate

    Power Automate Desktop (PAD) can interact with Word Desktop to embed the attachment as an object.

    1. Setup Power Automate Cloud Flow:

      • Use a trigger (e.g., "When a file is created" or manual trigger) to initiate the flow.
      • Pass the attachment file (e.g., PDF or Excel) and Word document template path to the desktop flow.
    2. Create a Power Automate Desktop Flow:

      • Open the Word template.
      • Use the "Insert Object" functionality in Word Desktop:
        • Navigate to Insert > Object > Create from File in Word Desktop.
        • Enable "Show as Icon."
        • Select the file path dynamically passed from the cloud flow.
    3. Save the Word Document:

      • Save the updated Word document with the embedded file.
    4. Return to Cloud Flow (if needed):

      • You can pass the updated document back to the SharePoint or OneDrive location via the cloud flow.

    Option 2: Use Office Scripts with Excel/SharePoint Integration

    If you have an environment with Office Scripts and Graph API enabled, you could:

    1. Create a custom Office Script or use a Graph API request to embed objects into a Word document.
    2. Automate the script execution via Power Automate.

    However, this option requires custom scripting and is better suited for advanced users with programming capabilities.


    Option 3: Workaround with Attachments as Hyperlinks

    If embedding the file as an object is not mandatory, you can link the file in the Word document as a hyperlink.

    1. Upload Attachments to SharePoint:

      • Use the cloud flow to upload the file to SharePoint or OneDrive.
      • Generate a shared link for the file.
    2. Update Word Template:

      • Use the "Populate a Microsoft Word template" action to insert the hyperlink into the Word document at the desired location.

    Why Native Cloud Flow Support for Embedding Objects Is Limited

    Power Automate Cloud Flow is designed for document automation but lacks the ability to directly embed objects in Word due to the complex binary structure of embedded objects in Word files. Using desktop automation or scripting provides a workaround.


    Tips:

    • If you opt for the desktop flow, ensure Power Automate Desktop is installed and configured with necessary permissions.
    • For frequent use, consider automating the task end-to-end using a hybrid approach with desktop flow for embedding and cloud flow for triggering and managing file storage.

    Let me know if you’d like detailed guidance for implementing any of these options!

    Best regards,
    @Ninjasabi

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 > Power Automate - General Discussion

#1
David_MA Profile Picture

David_MA 10 Super User 2025 Season 1

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 8 Super User 2025 Season 1

#3
ankit_singhal Profile Picture

ankit_singhal 7 Super User 2025 Season 1

Overall leaderboard
Loading started