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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Only add new row in ex...
Power Automate
Suggested Answer

Only add new row in excel if date matches parameter in another sheet

(0) ShareShare
ReportReport
Posted on by 44
I am using a condition that is set to only add a new row if date matches todays date. While the condition is working once the condition is met it is adding a new row for EVERY row in the other table not just the row that matches todays date. How do I get the flow to only add the row for the ones that match todays date? 
Categories:
I have the same question (0)
  • Suggested answer
    Ninjasabi Profile Picture
    122 on at

    Hi @ASmithRouse,

    The behavior you’re experiencing occurs because the flow is iterating over all rows in the table, and while the condition checks for a date match, the row addition is being performed for all rows. To fix this and ensure only rows matching today’s date are added, you can refine the flow logic as follows:


    Solution: Apply a Filter Before Adding Rows

    1. List Rows from the Source Table:

      • Use the "List rows present in a table" action to retrieve rows from the source table.
    2. Filter Rows by Date:

      • Add a "Filter array" action immediately after listing the rows.
      • Configure the Filter array to include only rows where the date matches today’s date.
        • Use the following expression for today's date:
          formatDateTime(utcNow(), 'yyyy-MM-dd')
        • In the Filter array condition:
          • Select the column containing the date.
          • Use the expression equals with the dynamic content for the date and the above expression.
    3. Add the Filtered Rows to the Target Table:

      • Use an "Apply to each" action and feed the output of the "Filter array" step as the input.
      • Inside the loop, add an "Add a row into a table" action to insert only the filtered rows into the target table.

    Example Flow Outline:

    1. Trigger: Your desired trigger (e.g., when the source Excel file is updated or a manual trigger).
    2. List rows present in a table: Retrieve all rows from the source table.
    3. Filter array: Filter rows where the date column matches today’s date.
      • Example filter condition:
        • Field: items('Apply_to_each')?['DateColumn']
        • Condition: equals(items('Apply_to_each')?['DateColumn'], formatDateTime(utcNow(), 'yyyy-MM-dd'))
    4. Apply to each: Iterate over the filtered rows from the Filter array action.
      • Add a row into a table: Add each matching row to the target table.

    Why This Works:

    • By filtering rows first, only the rows that match today’s date are passed into the "Apply to each" loop, ensuring only these rows are added to the target table.
    • The condition to match the date is evaluated once in the Filter array action, reducing unnecessary processing and ensuring accuracy.

    Debugging Tips:

    • Verify Filter Output: Add a Compose action after the Filter array step to inspect the output and confirm only matching rows are being passed.
    • Check Date Format: Ensure the date format in the source Excel file matches the yyyy-MM-dd format used in the filter condition. Adjust the format in the expression if necessary.

    Let me know if you need further clarification or assistance in implementing this flow. 😊

    Best regards,
    @Ninjasabi

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard