Skip to main content
Community site session details

Community site session details

Session Id : RhIVzuM8N9qUpbS2OGuJZW
Power Automate - Building Flows
Answered

How to compare an ID from excel file with an entire sharepoint list?

Like (0) ShareShare
ReportReport
Posted on 7 Apr 2021 18:26:58 by 98

Hello guys!

 

I have a list on Sharepoint where I need to update it with a new list.

It basically works like this: I take the ID that I have in excel from a new list and compare it with the ID that is already there in the Sharepoint.
Example:

If  IDExcel = IDSharepoint, update item. And so far it works very well!

 

But there is the case that: If there is no IDExcel within the Sharepoint list, create a new item. And this case is not working. Look at how I'm trying to do:

 

EXAMPLE=   

IDExcel = "123456", and I want to know if this IDExcel exists within the Sharepoint list.

 

carudev_1-1617819843134.png

 

carudev_0-1617819576472.png

 

  • Translate images: "Não contem" is like "Doesn't contain", and "Saidas" is like "Outputs". 

 

Value is the output of "Get Items", and I want to check if there is an ID inside the Value.

It doesn't have to be done exactly that way, but that's what I've managed to think so far.

 

Look at the IDLinha field inside the Value, this is what I need to use to compare::::::

carudev_2-1617819952567.png

 


So what I need is: check if an ID exists within my Sharepoint list and if it does not exist, create an item. But this comparison is not working, any ideas?

 

THANK YOU!!!

  • carudev Profile Picture
    98 on 08 Apr 2021 at 13:35:01
    Re: How to compare an ID from excel file with an entire sharepoint list?

    Thank you so much @NorthernChuck !! @Paulie78 's solution solved the problem, and thank you so much for taking the time to help me with this. ❤️

    I'm so grateful!!!! ❤️

  • Paulie78 Profile Picture
    8,416 Moderator on 08 Apr 2021 at 13:34:20
    Re: How to compare an ID from excel file with an entire sharepoint list?

    WOOHOO OMG! NO PROBLEM AT ALL, MY PLEASURE! 😂🤣

  • carudev Profile Picture
    98 on 08 Apr 2021 at 13:32:26
    Re: How to compare an ID from excel file with an entire sharepoint list?

    OMG!!!!!! IT WORKED!!! THANK YOU SO MUCH @Paulie78 . OMG!!

    I WAS ALREADY LOST WITHOUT KNOWING HOW TO MAKE THIS WORK, THANK YOU SO MUCH!!!!!

  • NorthernChuck Profile Picture
    152 on 08 Apr 2021 at 12:25:01
    Re: How to compare an ID from excel file with an entire sharepoint list?

    That makes sense to me. It would explain why the comparison wasn't working. Of all the small itches I have with PowerAutomate, I miss having a shell that provides feedback the most! Kudos on the excellent reply with a gif animation!

  • Verified answer
    Paulie78 Profile Picture
    8,416 Moderator on 08 Apr 2021 at 06:12:28
    Re: How to compare an ID from excel file with an entire sharepoint list?

    Your approach will not work because you are comparing the "Value" element from the get items action which is an array of objects. What you need is an array of IDs from SharePoint which will make your comparison work. You can do it with a select action like this:

    2021-04-08_07-04-47.gif

    This will produce you a clean array of IDs, which will look something like this:

    [
     1,
     2,
     3
    ]

    You can then easily do your comparison:

    2021-04-08_07-09-50.png

    Does that make sense?

  • Community Power Platform Member Profile Picture
    on 07 Apr 2021 at 22:37:44
    Re: How to compare an ID from excel file with an entire sharepoint list?

    I am having the exact same issue myself ... trying to compare an ID column in a SharePoint list to the ID column in a .csv file. If the Excel ID exists in the SPO list, update that list item with the data in the .csv file. Otherwise, create a new SPO list item and populate with .csv data. 

     

    I was following along with a YouTube tutorial (Power Automate - Bulk Add Excel data to SharePoint list), but the OData filter query isn't working for me. I was using:  LMSEnrollmentID eq 'ID' in the SharePoint Get Items action, where LMSEnrollmentID is a column in the SPO list and ID is a column in the .csv file. I'll be following this thread to see how it works out! 

     

     

     

     

  • NorthernChuck Profile Picture
    152 on 07 Apr 2021 at 21:01:31
    Re: How to compare an ID from excel file with an entire sharepoint list?

    So, the easiest way for me to help you is to try and recreate myself. I'll gladly help, but your sample data is in a picture format and it's rather large. Can you paste me in text that sample payload (replace things like Display Name: Kermit Frog, Email: kermit@frog.com - I just need sample data to reproduce) 

    #2 @vikulkar is very correct in their suggestion. Filtering using an Odata query would accomplish what you are looking for. If you had to, you could load the file more than once and then have more than one singular Odata filter to match up with your "series of treatments"

  • NorthernChuck Profile Picture
    152 on 07 Apr 2021 at 20:30:47
    Re: How to compare an ID from excel file with an entire sharepoint list?

    No worries @carudev !! 🙂 We will get to the bottom of this elusive evaluation. 
    Unfortunately I am out for the day, but I will review your post either later this evening or tomorrow morning!

    Cheers, 
    ~C

  • carudev Profile Picture
    98 on 07 Apr 2021 at 20:27:58
    Re: How to compare an ID from excel file with an entire sharepoint list?

    My flow works like this:

    Every day I receive an email with an excel file, so I get this excel and "ForEach" line inside it I compare it with the lines there in the Sharepoint list, if the file ID is the same as the ID in the Sharepoint list, I update it the item. And it works well, as I compare item by item using the ForEach ID on Sharepoint. 

     

    So now I need to deal with cases where the item in the file does not exist in the sharepoint. So I take the IDExcel that came in the file and check if that ID already exists or not in Sharepoint, because if it does not exist I will create it there in the Sharepoint list.

     

    Below more details of my flow:

     

    I use Get Items, then I use a For Each to work with the lines in the file, split them up and do a series of treatments on the lines:

    carudev_0-1617826703881.png

     

    And then I compare the line ID of the file with all the lines in the Sharepoint:

     

    carudev_1-1617826911398.png

     

    Value comes from Get Items, and this is its content of Value:

     

    carudev_2-1617827058795.png

     

    And the "Saidas" is this: that is the ID that I already have - it was extracted from the excel file - and I want to know if it already exists or not in Sharepoint.

     

    carudev_3-1617827165540.png

     

     

    Thank you guys! Sorry for the terrible English, but I think now I have better explained my problem. Thank you!

  • NorthernChuck Profile Picture
    152 on 07 Apr 2021 at 20:09:27
    Re: How to compare an ID from excel file with an entire sharepoint list?

    @carudev I'm following your logic. I trust that the data is there (or in this case not there). What I'm trying to help with is the evaluation. I'd really like to see the actual output of your evaluation of Value Nao Contem Saidas   I'm convinced it's something there. 

    If not, can you provide some sample data with 1 or 2 rows (records)? This way I can test as well. I once had a select that needed me to manually write out item() function with the array index number of 0. I find when things like evaluations don't work it's because of the expression....... 

    NorthernChuck_0-1617826099481.png

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete