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.
-
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.
-
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.
-
Save the Word Document:
- Save the updated Word document with the embedded file.
-
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:
- Create a custom Office Script or use a Graph API request to embed objects into a Word document.
- 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.
-
Upload Attachments to SharePoint:
- Use the cloud flow to upload the file to SharePoint or OneDrive.
- Generate a shared link for the file.
-
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