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 / Compare Emails and Rem...
Power Automate
Unanswered

Compare Emails and Remove User from 365 Group

(0) ShareShare
ReportReport
Posted on by
Hi all,

I have a flow that I want to remove users from a group if they don't exist in an excel file.

Currently I have:

List Rows (Excel) - Actual Name - Select Excel Rows
List Group Members (for the 365 group) - Actual Name - Select Group Members

I then select the emails from both of these. I have compose set up to view the outputs and I can confirm they both output exactly like the below:
[
  {
    "Email": "user123@mydomain.com"
  },
  {
    "Email": "user456@mydomain.com"
  }
]
I then have a filter array. I need this array to compare the group and the excel to leave me with just emails to use so I can remove them from the group.

So if user123@mydomain.com is in the group but not in the excel, this will then go to an apply to each to be removed from the group.

I have tried SO many things now and for the life of me I can't get this filter array to work correctly.

As far as I am aware, the below should work:

@not(contains(outputs('Select_Excel_Rows'), item()?['Email']))

But this won't let me add it as an expression. Whenever I get it 'working' it just doesn't have an output so removes all of the users.

Any help would be greatly appreciated!

TIA

 
PowerAutomate1.png
Categories:
  • David_MA Profile Picture
    15,591 Super User 2026 Season 2 on at
    Is this a one-time maintenance thing or are you trying to develop something where if someone is added to the group and they're not in the Excel spreadsheet, then you want to remove them? If it is a one-time thing, set it up like this and replace the compose action with the action to delete the person from the group:


    Some Notes:
    • The Excel action contains a query filter based on the e-mail address from the group matching an e-mail address in the spreadsheet:

    • The condition checks to see if one row was returned from the spreadsheet:

    • This is the expression used above: length(outputs('List_rows_present_in_a_table')?['body/value'])
     

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 426

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard