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

Excel for-each to match data with SQL

Im looking to have a Flow which would import data from Excel into SQL. However, i need to perform two sperate steps for when the Row (sql record) exists or is modified with updated data from Excel. I know i could easily create conditions, and then search SQL based on a specific columns, but i cant seem to figure out how to perform a for-each to have Flow cycle through each row. I would need for Flow to get the Excel Row, then i would get the SQL Row with a condition, then (i assume) i would use the "length()" expression to count the number of retrieve records (to determine whether its a new or existing record.

1 ACCEPTED SOLUTION

Accepted Solutions
v-zhos-msft
Level 10

Re: Excel for-each to match data with SQL

Hi @JoeO ,

 I have made a test on my side, please take a try with the following workaround:

I suggest you use the empty() function.

The expression is: empty(body('Get_rows')?['value']) is equal to true.

Capture4.PNG

 

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
JoeO
Level: Powered On

Re: Excel for-each to match data with SQL

Im thinking something like the Flow below. Would appreciate if one could confirm its correct. If the record in question exists, ill use the "Yes" step, if not, the "No" step

 

ExcelToSQL.png

 

v-zhos-msft
Level 10

Re: Excel for-each to match data with SQL

Hi @JoeO ,

 I have made a test on my side, please take a try with the following workaround:

I suggest you use the empty() function.

The expression is: empty(body('Get_rows')?['value']) is equal to true.

Capture4.PNG

 

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,057)