web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Creating a file and th...
Power Automate
Answered

Creating a file and then add a row into the table

(2) ShareShare
ReportReport
Posted on by 12
I'm trying to let Power Automate generate individualized excel file for each managers, using a template excel file.
This is my current flow.
This breaks at the last step "Add a row into a table"
Basically, I am reading a metadata excel file and get data from StoreAssignment table and Items table.  Then I get the list of unique managers from StoreAssignment table.
Then for each manager, I filter the stores 
{
  "type": "Query",
  "inputs": {
    "from": "@outputs('List_rows_present_in_a_table(StoreAssignment)')?['body/value']",
    "where": "@equals(item()?['Manager'],items('Apply_to_each'))"
  }
}
Then Get Region of the manager
{
  "type": "Compose",
  "inputs": "@first(body('Filter_Stores_for_each_manager'))?['Region']",
  "runAfter": {
    "Filter_Stores_for_each_manager": [
      "Succeeded"
    ]
  }
}
Then Filter items for each manager based on their Region
{
  "type": "Query",
  "inputs": {
    "from": "@outputs('List_rows_present_in_a_table(Items)')?['body/value']",
    "where": "@equals(item()?['Region'],outputs('Compose_(Get_Region)'))"
  },
  "runAfter": {
    "Compose_(Get_Region)": [
      "Succeeded"
    ]
  }
}
Then I get file content (the template file that I want to be used to generate files for managers)
 
Then I create file.  I put File Name dynamic like this:  
formatDateTime(utcNow(),'yyyy-MM-dd')_item_Count_items('Apply_to_each').xlsx
File Content is: body('Get_file_content')
 
So far, it ran without error and it created files correctly.   
 
The error happened at the next step:"Add a row into a table"
Here, I put outputs('Create_file')?['body/Id']
and Table wouldn't load as the file doesn't exist yet.  So I just typed in my table name.
Then for Row, I just typed this.
{ "CountDate": "@{utcNow('yyyy-MM-dd')}",
  "FC Name": "@{items('Apply_to_each')}"  }
 
It showed this message.
 
My template file has two tables and it is separated by three rows.(see below)  So I don't know why I get this error.
I am very new to power Automate.  Can anyone help me write into the HeaderTable?  
Categories:
I have the same question (0)
  • David_MA Profile Picture
    12,982 Super User 2025 Season 2 on at
    One issue I see is that your Excel template does not contain the kind of tables that Power Automate works with. You need to create the tables as outlined here: Create and format tables - Microsoft Support. You can tell if they are the correct type when the header column has a drop-down to filter the data in that column.
  • Verified answer
    stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    I think the reason is your tables layout in the Excel file.
    When you manipulate the first table ( as you did ), it created a side effect against the second table, which gave you insertDeleteConfilict error.
     
    Option 1: Consider moving the second table to right of the first table.
     
    Option 2: Separate the action.
                    Keep the first table in your template, remove the second table from the excel template.
                    After 'Add a row into a table', Add 'create table', Here define the table name, table range,                        column name.
     
    Option 3: Add Id column to your first table in the excel template file.
                    Before 'Get file content', add 'Update a row' to update the first table in the excel template.
                    Change your 'Add a row into a table', to manipulate the second table.
     
    There are also many other solutions/Options.
    good luck.
     

    Enjoy Power Platform and have a great day 🚀 |  My LinkedIn

    If the answer helps, please consider 👍, Thanks.

  • HK-11070012-0 Profile Picture
    12 on at
    I need to have both tables in one sheet so managers can easily identify their name.
    I've moved my second table to the right of the first table in the same sheet, and when I run this, I don't have the same error any more. 
     
    However, it does not write CountDate and ManagerName into the cells in created file, as I wanted to.  
     
    I wonder that's because I manually typed in the table name (HeaderTable, which is the top table)  The table doesn't exist yet, and that's why I did this. 
      
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    No, Type the table name manually won't be a problem if the name is correct.
    From your pic, everything looks ok. when you test it, you may need wait a few seconds until the data display.
    If you open it after the flow run, you might have empty values, you can wait a while.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard