Documents & Forms
Microsoft 365 & SharePoint Tools
Classic SharePoint Tools
Jun 28, 2023

How to fill Excel template using Power Automate and Office Scripts

Customer Support Engineer

In this article, we'll review how to fill an Excel template using Office scripts and how to do the same using Plumsail Documents.

In this article:

What are Office scripts in Excel

Office Scripts represent a scripting language within Microsoft Office applications, such as Excel and PowerPoint. It allows users to automate repetitive tasks, create custom functions, and enhance productivity by writing code directly within the Office application. With Office Scripts, users can record their actions as a script and then modify the recorded code as needed.

You will find more information in the Microsoft Office Scripts documentation.

Populate Excel Template using Power Automate and Office Scripts

Step 1: Upload your Excel template to a SharePoint folder.


I created a simple template with some description of a product.


Step 2: We need to use Excel online to enable Office Scripts. Open the uploaded file in the browser and click Automate.


Step 3: Now we can either write a script or use the Excel function Record Actions to generate the script. This is my script:


The script includes a main function, which receives values for Title, Description, Price, and Location.

   function main(workbook: ExcelScript.Workbook, Title: string, Description: string, Price: number, Location: string) {}

Then it switches to the Product worksheet.

   let product = workbook.getWorksheet("Product");

And applies the provided values to the specific cells: Title to B1, Description to B2, Price to B3, and Location to B4.


Check out the article on how to Record, edit, and create Office Scripts in Excel.

Step 4: The last step is to create a Power Automate flow. This is how the entire flow looks:


The flow starts whenever a new item is added to a SharePoint List called Products.


Then it creates a copy of our Excel template and fills it using the Run Script action from Excel Online (Business) package.


Limitations of using Office Scripts

While Office Scripts can be a powerful tool for automating tasks in Microsoft Office applications, they have certain limitations you may need to consider. Some of the limitations of using Office Scripts include:

  1. The complexity of template creation: Even with a simple scenario it requires some coding skills. Creating an advanced template becomes a real challenge for people who don't have a coding background.

  2. Limited external integrations: Office Scripts work within the cloud environment provided by Microsoft and integrating with external systems may require additional workarounds or custom solutions.

  3. Limited Application Support: Office Scripts are currently supported in a few Microsoft Office applications, such as Excel and Power Automate. If you are working with other Office applications like Word or PowerPoint, you won't be able to use Office Scripts.

How to populate Excel template with Plumsail Documents

Plumsail Documents is a service that can help to overcome some of the limitations associated with Office Scripts.

  1. The complexity of template creation

Unlike the Office scripts, you don't need to code something to create a template with Plumsail Documents.

It uses placeholders which are special tags within the template that work as dynamic fields. They are replaced with actual data during the document generation process.

Let's redo our Excel template to use it with the Documents service. This is how it looks now:


We also don't need to use Office Online to create the template. The desktop version works as well.

  1. Limited external integrations

To overcome the issue let's use Processes for generating documents from the template.

These are the steps.

Step 1: Create a new process, name it, and select XLSX.


Step 2: Upload our Excel template


Step 3: Specify the output file settings


Step 4: Select a delivery. There are a lot of possible delivery options. We'll pick the Email delivery.


Step 5: Specify recipients, subject and other email delivery options.


And that's it. The process is done.

Now we can start the process from any place. Plumsail Documents has a lot of integrations.


We'll use Power Automate. This is how the flow looks when using it with Documents.


Even if we want to change from Power Automate to Zapier or any other system, we would just need to select the process in the new platform, and it will be ready to run.

  1. Limited Application Support

Plumsail Documents overcomes the limitation. It supports various document formats, including DOCX, PDF, HTML, XLSX, PPTX and more. You can choose the appropriate template format based on your requirements and the output format you want to generate.

Get started

Register an account to try out document generation with Plumsail.

If you have any questions, feel free to send a request to our support team or leave your question in our community portal.