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 / How to filter excel fi...
Power Automate
Unanswered

How to filter excel file before adding to sql database

(0) ShareShare
ReportReport
Posted on by 8

Hi, 

Each day I have a email that creates an excel table from an attached file and then I have a flow that is trigger when a new excel file is created in SharePoint

BPatache_1-1702308340360.png

Then the table is filtered by "@" because I need to use only the lines that have values

 

BPatache_0-1702308262228.png

And then the data is saved into sql database

BPatache_2-1702308466513.png

BPatache_3-1702309160589.png

 

The problem that I have is that I need to add another filter

, if emploieeid (sql) is found in Emploiee Id (in excel file) than don't add to sql database

 

At the moment if the excel file is created with same data from a day before, is imported in sql and creates duplicates 😞

 

This is how my flows looks like

BPatache_4-1702309193421.png

 

Kind regards

Bogdan

 

Categories:
I have the same question (0)
  • v-yueyun-msft Profile Picture
    on at

    Hi , @BPatache 

    According to your description, you want to just update the row if the emploieeid is found in your Sql database.

    First , you need to get the distinct emploieeid in your sql database. [You can use the Select action to get the id array and use the union() function to get the distinct of the emploieeid in your sql database].

    vyueyunmsft_0-1702349724420.png

    Scond , you can filter your Excel file like this:

    @and(contains(item()?['WorkEmail'], '@'),equals(contains(outputs('Compose_2'), item()?['emploieeid']), false))

    vyueyunmsft_1-1702350021563.png

    You need to change the columnName in your side .

    vyueyunmsft_2-1702350087854.png

     

    Best Regards,

    Yueyun Zhang

     

     

  • BPatache Profile Picture
    8 on at

    Hi Yueyun,

     

    Thanks for you replay, 

     

    Sorry if I wasn't to precise in my explanation, I need the exact opposite than what you said

    Update Sql only if the employeeid is not found

     

    Is on for an appraisal app and I need one record per employee per year.

    I will se up an flow to delete the records older than 6 months to make sure the employeeid is not there for the next appraisal.

     

    I will try to replicate your option with "not(contain())"

     

     

    Thanks

    Bogdan

  • v-yueyun-msft Profile Picture
    on at

    Hi , @BPatache 

    Thanks for your quick response ! Sorry i may make a mistake in my reply.

    equals(contains(outputs('Compose_2'), item()?['emploieeid']), false)

    The code is used to judge if [emploieeid] in your Excel file is not exist in your sql database.

    If yes: emploieeid do not contain in sql database.

    If no: emploieeid exist in sql database.

     

    Best Regards,

    Yueyun Zhang

  • BPatache Profile Picture
    8 on at

    Hi Yueyun,,

     

    I have tried your option but I think I am doing something wrong as the filter doesn't work.

    I had an excel with 4 lines witch2 of the lines already existed in my sql database.

     

    After I run the flow, all 4 lines were added to my sql database

     

    This is what I did

    get rows from sql

    BPatache_0-1702454511387.png

    created the select function

    BPatache_1-1702454538537.png

    created the compose action

    BPatache_2-1702454567858.png

     

    Created the filter function

    BPatache_3-1702454639359.png

    and then apply to each /insert row

    BPatache_4-1702454673109.png

     

    BPatache_5-1702454726718.png

     

     

    Regards

    Bogdan

     

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard