Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Compare data between sharepoint list and excel

(0) ShareShare
ReportReport
Posted on by 10

I have a sharepoint list and an excel spreadsheet. All data is identical, one column contains a price. I have used the 'List rows present in a table' connector to get all the excel data. I now want to compare all the data in the price column of the sharepoint list and the excel sheet and if there are any differences post a teams message with a table of the items that have changed. I have tried various scenarios but can't get the flow to return the correct data. I have searched the forums and tried some of the suggestions, just can't get it to work correctly. Any guidance would be much appreciated.

  • Verified answer
    grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on at
    Re: Compare data between sharepoint list and excel

    This is how I would build the flow which avoids using any loops so it's much more efficient, especially with a large number of items.

     

    The Excel Table below is what I've used in this example.

    grantjenkins_0-1676728824235.png

     

    And the SharePoint List.

    grantjenkins_1-1676728857816.png

     

    Note that the first (Alpha) and third (Gamma) prices are different.

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_2-1676730803398.png

     

    Recurrence will run the flow according to your schedule.

    grantjenkins_3-1676730852649.png

     

    Get items and List rows present in a table will retrieve the items from your SharePoint List and Excel Table.

    grantjenkins_4-1676730893299.png

     

    Note that Get items only returns the first 100 items by default, and List rows present in a table only returns the first 256 items. If you have more items that this you will need to go into the Settings, turn on Pagination and set a Threshold larger than the number of rows you expect to have over the next couple of years at least.

    grantjenkins_5-1676731144807.png

    grantjenkins_6-1676731162025.png

     

    grantjenkins_7-1676731183095.png

    grantjenkins_8-1676731196877.png

     

    XML is a Compose that converts the Excel data to XML so we can use XPath expressions. The expression used is:

    xml(json(concat('{"root": { value:', outputs('List_rows_present_in_a_table')?['body/value'], '}}')))

    grantjenkins_9-1676731286448.png

     

    Filter array uses the output from Get items and filters the items using the following XPath expression. This will give us only the items where the prices are different.

    xpath(outputs('XML'), concat('number(//root/value[Description/text()="', item()?['Description'], '"]/Sell_Price_Per_Unit/text())'))

    grantjenkins_15-1676732212828.png

     

    Create HTML table uses the output from Filter array and uses the following expressions. You would map what fields you want to show in the table.

    //Description
    item()?['Description']
    
    //Sell Price Per Unit (formats as currency)
    formatNumber(item()?['Sell_Price_Per_Unit'], 'C2')

    grantjenkins_11-1676731537361.png

     

    Post message in a chat or channel uses the output from Create HTML table. You could just use the raw output, but it would look very basic, so good to add a bit of styling. Note that posting in chat doesn't like CSS so I've replaced <th> and <td> elements with some styles. 

    replace(replace(body('Create_HTML_table'), '<th>', '<th style="padding: 10px; border: 1px solid #ddd;">'), '<td>', '<td style="padding: 10px; border: 1px solid #ddd;">')

    grantjenkins_13-1676731988413.png

     

    And the post in the channel:

    grantjenkins_14-1676732012455.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • brynnthomas Profile Picture
    10 on at
    Re: Compare data between sharepoint list and excel

    This solution seems to have worked, there were some null cells in the excel sheet which were causing issues. One last question, where in your flow do I add the create html table and what dynamic content do I use? I'm concerned with creating a repetitive loop and posting multiple messages in teams.

  • v-jefferni Profile Picture
    on at
    Re: Compare data between sharepoint list and excel

    Hi @brynnthomas ,

     

    Assuming that there is a price in Excel cannot be found in SharePoint, then which price you need to include in the Email, from Excel or SharePoint?

     

    Best regards,

  • takolota1 Profile Picture
    4,898 Super User 2025 Season 1 on at
    Re: Compare data between sharepoint list and excel

    @brynnthomas @v-jefferni 

    In that case you can adjust the SharePoint filter query to 
    Description eq 'Name' and Price ne 'Price'

    That will only return values for the ones where the prices don't match. Then in the following Apply to each you may be able to append the entire JSON record value to the array variable.
    Then after both the loops you could use a Parse JSON on that array variable which should then have a JSON array.
    https://www.youtube.com/watch?v=e0dzMqoJGtY 

  • brynnthomas Profile Picture
    10 on at
    Re: Compare data between sharepoint list and excel

    The only column with unique values is the Sell_Price_Per_Unit column. All other columns have identical data. I need the query to return data from other columns if the Sell_Price_Per_Unit differs between the excel column and the list column.

  • RachelGomez123 Profile Picture
    31 on at
    Re: Compare data between sharepoint list and excel

    You can maintain data integrity more effectively using a SharePoint list than an Excel spreadsheet due to the mix of rights, forms, targeting, and data validation control sets. Make an audit trail of every item on the list. Every item in the SharePoint list includes an edit history and a version history.

    Regards,

    Rachel Gomez

  • v-jefferni Profile Picture
    on at
    Re: Compare data between sharepoint list and excel

    Hi @brynnthomas ,

     

    Does the Description columns in both the table and list include unique values? If so, you can use this column value to compare the two tables and get differences.

    vjefferni_0-1676620790638.png

    vjefferni_1-1676620868962.png

     

    The result array will include all descriptions that having different prices and be used for creating HTML table then use in Post adaptive card in a Teams channel.

     

    Best regards,

  • brynnthomas Profile Picture
    10 on at
    Re: Compare data between sharepoint list and excel

    Below are screenshots of the columns I need to compare. Both number type columns. I need data returned where sell price is different. Unable to share raw data.

     

    brynnthomas_0-1676617000699.pngbrynnthomas_1-1676617282763.png

     

  • v-jefferni Profile Picture
    on at
    Re: Compare data between sharepoint list and excel

    Hi @brynnthomas ,

     

    Please share actual columns of the Excel table and the list, with screenshots and sample data is appreciated.

     

    Best regards,

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

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!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1