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 / Compare sharepoint lis...
Power Automate
Unanswered

Compare sharepoint list against excel table

(0) ShareShare
ReportReport
Posted on by 48

Hello,

 

I have a sharepoint list and a excel tabel that i want to compare.
The excel-list (in a table) is the raw data, and will always update the SharePoint List. Sometimes the excel-list will have less data than the SharePoint list. When this happens, i want the item in the SharePoint list to have a status set from from Active to Passive.

The excel-list will max have around 400 lines.

Does anyone knows if this is possible, and what kind of way i should to go do this?

Categories:
I have the same question (0)
  • Verified answer
    creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    Yes it is. You need to use the Filter Array action to cross-reference the Excel data against the data in SharePoint. 

     

    In this flow Example. I'm cross-referencing my Excel data against what is already entered in SharePoint. Anything SP Item that doesn't exist in the Excel file I'm deleting. You can take this concept and adjust it for your flow. Instead of deleting the SP Item you can update it to adjust the status.

     

    Any item that doesn't already exist in SP will be added (in my case). It may differ for your flow. 

    creativeopinion_0-1692022441647.png

     

    Note: Scope actions are optional. I use them in my flows to organize and group actions together.

     

    Get Excel Data

    I'm dynamically returning a table for the List rows present in a table action. If you want to know how to do this—you can follow this tutorial I uploaded to YT. Otherwise, you can omit the 3 actions I've outlined below and just use a List Rows present in a table action. 

    creativeopinion_2-1692022533563.png

    Your Excel file must have a unique ID that you can use to cross-reference against what is already on SP. Use the Select action to help you extract just the data from the column that contains your ID. In my case, I have a column named ID. Yours may be something different. 

     

    For this, you don't need a key so you can click on the icon to the right of the Map file to switch to text mode. The Select action will return an array. You will need to convert it to a string. 

     

    Use a Join action to convert the array to a string. The outputs from the select action will go into the From field. In the Join field, enter a comma and a space.

    creativeopinion_3-1692022632016.png

     

    Tip: Add a Top count with a smaller number so it only returns a small set of data while you are building out the flow. Rather than returning your entire list.

    creativeopinion_7-1692023451505.png

     

    Get SP Data

    You will need to mimic the steps above but for SP. Use a Get Items action to get the items from your SP list. Add a Select action to get the same unique ID (you'll need this to compare to the unique IDs from your Excel file). For my SP list, the ID is stored in a column named Email ID. 

     

    Add the Join function and use a comma and a space.

     

    creativeopinion_4-1692022763540.png

     

    Tip: Add a Top count with a smaller number so it only returns a small set of data while you are building out the flow. Rather than returning your entire list.

    creativeopinion_6-1692023402953.png

     

    Run a test.

     

    Your outputs from the Join actions should look like this. Array in the Inputs, a string in the Outputs.

    creativeopinion_8-1692023547432.png

     

    Update/Create/Delete

    Depending on your requirements you can then add parallel branches to update, create or delete a SP item. For my example I have two things that can happen.

     

    1. If the item in Excel doesn't exist in SP—Create a new item in SP
      creativeopinion_5-1692022971446.png
    2. If the item in Excel doesn't exist in SP—Delete the item in SP

     

    If the item in Excel doesn't exist in SP

    You need a Filter Array action. In the Filter Array action, you have to use the Values returned from the List rows present in a table action in the From field.

     

    In the first Value field, you need to insert the outputs from the Join action with your SharePoint ID string. In the second Value field, you need to insert the dynamic content from the List Rows present in a table action that you want to cross-reference with. In my case, it's the ID column.

     

    Add a Compose action to store the number of items returned from the Filter Array action. This will help with troubleshooting. You can also use the outputs of this compose action to check if your Filter Array action is working correctly.

     

    creativeopinion_9-1692023721367.png

     

    In the Compose action insert an expression. Use the length() function and insert the body outputs from the Filter Array action above.

     

    Run a test. 

     

    Do not add the next actions until you've sorted out the Filter Array action and it's filtering out the correct data. 

    Add Excel Data to SharePoint

    In the branch where you've filtered out the Excel data that needs to be added to SP, you need to add a Condition to check if there are any items returned. If not, nothing happens. If so, you want to add those items to Excel.

     

    In the Condition action, you'll add the Compose action output from above that contains the count of items returned.

     

    I've set my operator to is equal to, and set the value to 0. If no items are returned, nothing happens (YES branch). 

     

    In the NO branch, add an Apply to Each action and a Create Item action. For the Apply to Each action, you want to loop through each item returned from the Filter Array action above (in the current branch). T

     

    his will loop through each Excel item that doesn't currently exist in your SP List. You need to insert the Body outputs from that Filter Array action. 

    creativeopinion_1-1692111675960.png

     

    Because you are using the Filter Array action to filter out your items. There will not be any dynamic properties that you can select from in order to return values from the Filter Array action.

     

    Note: The screenshot above shows labels that look like I have selected dynamic content from the Filter Array action, but that's just something PA does after the flow is run, it changes the look of the labels.

     

    You need to use an expression to access the values from the Filter Array action. The outputs from the Filter Array action from your last run will display the information you need for the expression. The key for each value is in the red text between the double quotes. 

    creativeopinion_2-1692111912516.png

     

    To access each item you need to use the item() function. Each expression will start the same like below:

     

    item()?['']

     

    Between the single quotes is where you want to enter the key—exactly how it's displayed in your outputs.

     

    For example, to return the First Name I would use this expression:

     

    item()?['First Name']

     

    creativeopinion_3-1692112074970.png

    As mentioned earlier, the dynamic content labels will be the Expression Labels (in pink as you see above). However, once you run the flow, they will switch to the Data Operator labels (in purple). 

     

    Important: Once the labels switch to the Data Operator labels, you cannot select the label and edit the expression. You'll have to delete the label and re-enter the expression. Not sure why this happens... but it is what it is.

     

    Delete/Update SharePoint Items

    I'm not sure what your workflow is and if you need to delete or update the SP item. However, the concept is the same. I'm going to cover how to Delete an item, but you can customize the actions to suit your requirements.

     

    In the branch where you have filtered out the SP items that don't exist in your Excel table, add a Condition. Just as you did previously. 

     

    Insert the Compose action that returns the number of SP items that don't exist in your Excel table. I chose the is equal to operator and entered the value of 0.

     

    In the Apply to Each action, insert the Body outputs from the Filter Array action that has filtered out SP items that don't exist in your Excel table.

     

    Add a Delete or Update Item action. Both of these actions requires the ID of the SharePoint item to delete or update. 

     

    creativeopinion_4-1692112241146.png

     

    Just like you've done above, you need to use an expression to access the SP Item ID. Use the item() expression and the ID key which is 'ID' to access the ID value.

     

     

     

    item()?['ID']

     

     

     

    creativeopinion_5-1692112544867.png

     

    Hope this helps!


    If I helped you solve your problem—please mark my post as a solution ✅.
    Consider giving me a 👍 if you liked my response!

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok

     

  • DPH Profile Picture
    48 on at

    Hello! First of thank you so much for the detailed post!

     

    Update: I change this post, i have come some steps longer.


    I have now made a filter array that works from the excel, and one that works from SharePoint.
    As i understood, this is the correct output that will be filtered further in next step?

     

     

    Filterarrays.jpg

     

    Flow2.jpg

  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @DPH No worries actually working on a YT tutorial that will cover this exact scenario. 

     

    Anyway, I've updated the original post with additional instructions.

  • DPH Profile Picture
    48 on at

    Thank you!

     

    Right now i manage to create item directly from excel-list, this work so great and fast!, but i struggle to find a way to update the item in SharePoint list from the excel-document if something is change.

     

    and how do you update the sharepoint items from the excel when SharePoint List item is already created? As i can see the sharepoint list item need the item-ID`?

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard