Insert chart as an image from excel to word using Microsoft Graph and Power Automate
Microsoft Graph is the gateway to data and intelligence in Microsoft 365. It provides a unified programmability model that you can use to access the tremendous amount of data in Microsoft 365, Windows, and Enterprise Mobility + Security. We are using Power Automate with pre-build connectors to automate the process.
For this scenario we have created a simple Chart, and we store the excel file in the SharePoint Library.
The Rest API that we use returns the value base-64. Additional parameters can b provided, check here.
Above request Url is used for the OneDrive, the following one is used for SharePoint:
In Power Automate flow we use HTTP with Microsoft Entra ID (preauthorized) connector where we invoke an HTTP request.
We gat base-64 value from the outputs body.
In order to populate image inside Word document we need to parse base-64 value inside JSON schema
Next, we need to create word template which contains Picture content control. This can be inserted from Developer tools, check below.
We save the file in SharePoint Document Library and then we pick it up in the next action in Power Automate by using Populate a Microsoft Word Template connector.
Next action is to save the file in the target SharePoint Library as word document. We chose the location and get the dynamic content from the previous action.
Finaly, we got the image uploaded in the word document.
Hope you enjoyed :)