Insert Row into Data Table in Power Automate Desktop

Most of us commonly work with data on a daily basis, where the data is arranged in columns. One of the everyday tasks is to create data tables to store data in Power Automate Desktop.

In this tutorial, first, I will show you how to create a data table in Power Automate desktop flow, along with the following topics:

  • Insert a new row into a data table in Power Automate Desktop
  • Insert a row into the data table using variables

Create a Data Table in Power Automate Desktop

A data table is a collection of rows and columns that store different types of data in a tabular format, similar to an Excel Worksheet. This is a zero-indexed variable type, which means that to get the first row from a data table, you need to refer to the zero index.

Suppose you have product-related data that includes details such as Product Name, Product ID, Product Stock, In Stock, and Category, and you want to create a data table with these details.

Let’s see how to create a data table in Power Automate Desktop. Start from the steps below:

If you are a beginner, read this tutorial to learn about the basics of Power Automate Desktop and create your first flow.

  1. Open the Power Automate desktop app, click on the + New drop-down on the top left side, and provide a name for your flow. Tap on the Create button. Then, it will open the workspace window directly, allowing you to drag and drop actions.
Power Automate Data Table
  1. Under the Actions pane, search for the data table, then drag and drop the “Create new data table” action to the workspace. This will create an empty data table. Configure the information below.
    • Variables Produced: I have renamed the variable name to ProductDetails.
    • New Table: By default, it has 0 Rows, 0 columns.
Power Automate desktop datatable
  1. Then, click on the Edit button to add the columns to a data table. After that, click on the + button on the top right side to add columns. To add rows, click on the + icon at the bottom of the page. Click on the Save button.
    • Rename the column headers and add values to the data table.
  1. As you can see, I have added four rows and five columns to the data table.
Create Data Table in Power Automate Desktop
  1. Now, save and run the flow by clicking on the Run button. When the flow executes, check the flow variable (ProductDetails). You can see the output as a data table in the screenshot below.
Power Automate desktop create datatable

This way, you can create a data table in Power Automate desktop. Now, let’s insert a row into a data table in Power Automate Desktop.

Insert a New Row into Data Table using Power Automate Desktop

We have created a data table in the previous section, let’s check on inserting a new row into the data table.

  1. Expand Data table variable, drag, and “Insert row into data table” action. Provide the required parameters. Next, click on the Save button.
    • Data table: Click on {X} -> Select Data Table variable.
    • Into location: Select the End of data table option.
    • New value(s): Provide the values within %[]% separated by a comma.
Insert row into data table Power Automate desktop
  1. When you save and execute the flow, it will add a new row to the data table. Have a look at the reference image:
Power Automate desktop insert row into a data table
Note: The values provided in the Add a new row to the data table should match the number of columns in a data table. If we are adding more or less, the flow will generate an error like below.

When you are inserting the row to the data table , the column count of list or data row must match to the column count in the data table.

Microsoft.PowerPlatform.PowerAutomate.Desktop.Actions.SDK.ActionException: The number of values provided to be added (4) doesn't match the columns of the data table (5).
Data Table Actions in Power Automate

Insert Row into Data Table Using Variable in Power Automate Desktop

Alternatively, you can also add a new row to an existing data table by using the Set variable action in Power Automate desktop flow.

Now, we have the data table with the following details:

Power Automate Desktop add row to data table

Let’s add another row to the data table.

  1. Search for the “Set variable” action under the Actions pane, and then drag and drop it to the workspace. Click on the Save button.
    • Variable: Rename the variable if you want.
    • Value: Provide the expression with a data table variable plus the values you want to add in brackets. Follow the code below.
Expression: %DataTable + ['Charger', 'P1006', '65', 'Electronics', 'True']%
Add row to data table Power Automate desktop

Save and run the flow by clicking the Run button.

  1. After the flow execution, under the Flow variables section, right-click on an AddRowtoProducts variable.
Add variables to a Data Table on Power Automate Desktop
  1. You can see the output by adding a new row to the data table with the row index ‘5’. Check out the image provided below.
Insert a row in data table Power Automate Desktop

This way, you can add a new row to the Excel table using Power Automate Desktop.

I hope you learn now how to insert a Row into a Data Table in Power Automate Desktop. I hope you found this article helpful. Please mention your suggestions in the comment section.

Also, you may like the following tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…