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 / Form to Spreadsheet - ...
Power Automate
Suggested Answer

Form to Spreadsheet - do not allow duplicates added

(0) ShareShare
ReportReport
Posted on by 2
I'm trying to create a flow that takes a submission from a Form and adds it to a Spreadsheet hosted on Sharepoint.  Here is how I currently have it set up:
 
1.) When a response is submitted, and I select my form
2.) Get response details from the form
3.) Initialize Variable.   The name is "isDuplicate" and it is set to "false"
4.) List rows present in a table - I selected the spreadsheet on SharePoint
5.) For Each - select an output from the previous steps: body/value
6.) Condition - if "Employee ID" from the spreadsheet is equal to "Employee ID" from the form AND "Facility", from the spreadsheet, is equal to "Employee Facility" from the form (thus, identifying the duplicate entry)
If True - Set variable "isDuplicate" to TRUE
If False - nothing
7.) New Condition - Not nested in "For Each" if 'isDuplicate' variable is set to "true"
If True - send an email to the user letting them know - then set 'isDuplicate' variable to false
If False - add form submission data to Spreadsheet
 
 
unfortunately, this is not working...and I cannot, for the life of me, figure out why... It must be that I dont have a solid understanding of how Power Automate is rendering the data?
 
I assumed if I kept the "For Each" loop separated, then Power Automate would cycle through all of the current entries in the Spreadsheet... if, after cycling through all entries (currently sitting at 83), it does not find a duplicate value, then "isDuplicate" remains "false" and, thus, gets added to the Spreadsheet
 
If it cycles through all 83 entries and a duplicate is found, even if that duplicate is found on line 53, then lines 54 through 83 all still get checked, per the "for each" loop, but since they're all "false" and "false" is "nothing", then 'isDulicate' should remain "true" until it's set back to "false" after sending the email.
 
However...Power Automate still just adds the submission to teh Spreadsheet, even though a duplicate entry already exists.
 
See attached screenshot for a visual... you can ignore the very first condition, all it is doing is checked a selection box, from the form, to determine which path to pursue.  It's all of the actions nested under the "True" statement that I am struggling with.
MyFlow.png
Categories:
I have the same question (0)
  • Suggested answer
    Mark Nanneman Profile Picture
    993 Moderator on at
    A problem with your current flow is that the variable is just going to get reset each time in the loop, so it won't do what you want it to do.

    Instead of "For Each" loops and setting variables, the best way to do this would be to use filters on your "List rows" action. and just see if you get any rows.

    Your filter on the List rows would be something like 'Property Name 1' eq 'Value 1' and 'Property Name 2' eq 'Value 2'.

    It'll run much faster and look much cleaner.

    Then you can count the rows found from "List rows" with the Length() function, and you can base your condition for email vs adding a row on that value.






    If this helped you, please click "Does this answer your question" and give it a like to help others in the community (+ close the ticket)!

    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff  |

     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 419

#2
Vish WR Profile Picture

Vish WR 314

#3
David_MA Profile Picture

David_MA 260 Super User 2026 Season 1

Last 30 days Overall leaderboard