Excel Power Automate



Please note, that the Excel connector for Power Automate has many Known issues and limitations, so it isn't recommended if at all possible. If you could provide an expanded screenshot of your Flow and steps, and of any detailed error messages you're receiving we could likely better assist you. I created Microsoft Form for collection of Excel files in a specific template from my team members on daily basis. I need to combine all received files in a particular day in a single master Excel file (contains progress of past days) which will be forwarded to my manager. Table format for templat.

Note

There is simpler way to create Excel and PDF documents from a template and use the result in Power Automate if needed.

If you want to automate the generation of purchase orders in your company, this article will help you achieve that.After going through it you will know how to create an XLSX file from a template using Create XLSX document from template action from Plumsail Documents connector in Power Automate (Microsoft Flow) and Azure Logic Apps.

Probably you have some third party system, where you create data for purchase orders.Then you get this data in Power Automate (Microsoft Flow), apply it to our purchase order template and generate a new document.

Excel Power Automate

This is how the final document will look in our case:

Our template and result document have to be stored somewhere. Power Automate (Microsoft Flow) has a lot of connectors for different systems. Here are just a few of them:

  • SharePoint

  • Box

  • OneDrive

  • Google Drive

  • Dropbox

  • SFTP

  • File System

Excel Power Automate

In this example, we will store our documents in SharePoint. Our flow will use JSON object as a source data for the template, but you can get data from other sources. For example query list items from SharePoint.

This is how the flow looks like:

Flow trigger¶

You can actually pick any trigger. For example, you can start Flow on file creation in a SharePoint document library. We are using “Manually trigger a flow” trigger here to simplify the Flow.

Get file content¶

This action gets file content of the specified file from a SharePoint document library. You can just specify SharePoint site URL and path to your file. We are using this action to get our template’s content.

You can use any other connector to get files from your system.

Create XLSX Document from Template¶

Create XLSX document from template is the action from Plumsail Documents connector. This action is suitable for creating documents from a template.

There are two parameters:

  1. Template file

  2. Template data

In the first parameter ‘Template file’ you can put template’s content from some other action. In our case, we specified the output of the previous action as a template.

Download the template file that we will use in this article.

Plumsail Excel XLSX templates use a different approach than most other templating solutions. It uses a minimal amount of syntax to make your work done.

Excel Power Automate

Read this article to get familiar with the templating engine.

In short, templating engine thinks that everything between these {{}} brackets is basically variables where it will write the data you specified in ‘Template data’.In our case, the example would be {{Order.Date}} and {{Order.Number}} object, it lets the engine know that we want to render the purchase order’s number and date.

But of course, we can implement a more complex scenario, in our template we are referring properties inside simple objects and collections, as well as properties in nested constructions.To select properties of our objects inside of the array (in JSON data) we are using a dot operator:

  • The {{Vendor.CompanyName}}, {{Vendor.Address}}, {{Vendor.Email}}, {{Vendor.Phone}} tags let the engine know that we want to render properties of the Vendor object.

  • The {{ShipTo.CompanyName}}, {{ShipTo.Address}}, {{ShipTo.Email}}, {{ShipTo.Phone}} tags let the engine know that we want to render properties of the ShipTo object.

  • The {{items.product.name}}, {{items.quantity}}, {{items.product.price}}, {{items.cost}} tags get the name, quantity, price and total cost properties in each item’s product object.

The templating engine is smart enough to understand that we refer properties inside a collection.That is how it knows what content we need to be duplicated. It will iterate through all objects in the array to render them and add the rows automatically.

You can learn more about table rendering here.

Please also note that we are using these formulas to calculate the total cost for each item individually and for all of the items:

  • =[Quantity]*[UnitPrice] - for each item

  • =SUM(D14) - for all of the items

In the second parameter, we specified data that is being applied to the template in JSON format:

Create file¶

Now you need to store text file somewhere. In our example, we use ‘Create file’ action from SharePoint connector to store the XLSX document in SharePoint document library.

You can use any other connector to store documents into your system.

Conclusion¶

Excel Power Automate Add In

Now you should have an idea how to use Create XLSX document from template action from Plumsail Documents connector for Power Automate (Microsoft Flow).If you haven’t used it yet, registering an account would be the first step. It is quite easy to get started.