Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Check for Duplicate prior to Insert Rows for SQL Server

I am working on a flow that will help import data into an azure sql database (access web app) from an excel sheet that will be regularly exported to a onedrive folder.


I was able to insert the rows from the excel table into the sql table. Now, I am hoping to add some sort of duplicate checker. Currently, I have the sql table set to have a required field "offeringID". I am trying to figure out how to have the flow lookup the row in the excel table to see if offering id already exists in the sql table. If it does not, then it should insert the row. If it does then it should "update" the row. I am struggling with how to get the data from the rows prior to the "for each" insert row step.


I see where you can filter data based upon values when getting a row but I must be doing the order incorrectly.


Any ideas of an approach to tackle this?

Flow Staff melim
Flow Staff

Re: Check for Duplicate prior to Insert Rows for SQL Server

Hi Nick,


From your question, it sounds like you have a OneDrive trigger then two action  connectors, one to get the Excel rows and one to get the SQL table.  After your 'Apply to each' connector, you can add  a 'Condition' connector to do a comparison between the new rows in Excel and the existing rows in SQL.  This will give you the option to continue with the operation and insert the rows into SQL or do nothing.


I hope this helps.  Let me know if you have any additional questions.

Not applicable

Re: Check for Duplicate prior to Insert Rows for SQL Server



I'm also battling with this and the previous answer is a little vague.


I'm getting two 'arrays' or lists, one from source, one from destination.

For each item in the source I want to check if it exists in the destination and if not, insert a row.

I'm using an array output from Planner as the source and Excel as the destination.


The Condition will automatically fall inside the existing "for each", so it cannot check another list as that would nest the for each which is not how exactly do you do this?  Can you please provide an example?


Kind regards,


Helpful resources


Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.


Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.


Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Microsoft Learn

Learn how to build the business apps that you need.


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 69 members 3,435 guests
Please welcome our newest community members: