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.
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.
And the SharePoint List.
Note that the first (Alpha) and third (Gamma) prices are different.
See full flow below. I'll go into each of the actions.
Recurrence will run the flow according to your schedule.
Get items and List rows present in a table will retrieve the items from your SharePoint List and Excel Table.
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.
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'], '}}')))
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())'))
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')
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;">')
And the post in the channel:
----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.
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.
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,
@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
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.
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
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.
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,
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.
Hi @brynnthomas ,
Please share actual columns of the Excel table and the list, with screenshots and sample data is appreciated.
Best regards,
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1