web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Best way to compare Excel data against Dataverse data?

(0) ShareShare
ReportReport
Posted on by 39

I am looking for the best way to compare data from an excel sheet to data that is used in our Dynamics Sales application. 

Use case: When we attend trade shows, we usually receive the list of attendees in advance via an Excel spreadsheet. We can only use the list one time, so we carefully plan the communication that goes out to the attendees. We like to tailor the messaging based on whether the attendee is a current client of ours, a current prospect, or a partner / vendor / competitor. I would like an automated way to see if the people on the list are currently in our CRM as contacts, customers, leads, etc. Ideally I'd like a way to do this that doesn't require me to import the list into Dynamics, since we aren't permitted to use it more than once. It would be great if I could just add another column to the Excel spreadsheet that indicates whether the attendee is in our CRM in some capacity and have a flow that runs and populates the sheet.

I tried a few different flows in Power Automate but was not successful. I am a novice, though, so rather than detail the flows I tried, I'd rather see how others might approach this problem. Thank you in advance for any suggestions you're able to provide!

I have the same question (0)
  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Best way to compare Excel data against Dataverse data?

    Hi shogg,

    First, you need to decide the criteria by which you can define the duplication. For example if the 'name' + 'contact number' is in the excel or in the CRM than it is a dupliatioon. After that you can create  a key in that table and use excel import to create new records. 

  • shogg Profile Picture
    39 on at
    RE: Best way to compare Excel data against Dataverse data?

    Hi Abdul,

    The key would be the email address, which would be unique. However, I do not wish to import new records into the CRM. I only want a way to check which email addresses in the Excel sheet already exist within my CRM.

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Best way to compare Excel data against Dataverse data?

    Hi shogg,

    In that case, Power Automate is a suggestion for you. 

    1. Make two folders in excel
      1. In progress
      2. successfully parsed
    2. Use the below component if you are using share point for that purpose
      1. pastedimage1675867340763v1.png
    3. Parse all the rows of excel using the below component
      1. pastedimage1675867393641v2.png
    4. Use the below Components to parse each record
      1. pastedimage1675867567695v3.png
      2. pastedimage1675867610003v4.png
    5. When the record is found in the CRM then update the excel sheet using the below components
      1. pastedimage1675867810742v5.png
      2. pastedimage1675867817240v6.png
    6. Once the file is updated then move it to the folder successfully parsed using the blow component
      1. pastedimage1675867920316v7.png
  • Verified answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    RE: Best way to compare Excel data against Dataverse data?

    Hi shogg,

    You can create one flow to achieve your goal, and you need use 'Excel Online (Business)' connector to get and update data in the excel.

    https://learn.microsoft.com/en-us/connectors/excelonlinebusiness/ 

    Steps:

    Create EXCEL with an account that has access to CRM data.

    pastedimage1675926480786v2.png

    Select all data to create table in the excel:

    pastedimage1675928703527v7.png

    Go to Power Automate to create one instant flow.

     Initialize variable

    pastedimage1675930360785v15.png

     List rows present in a table(Excel):

    pastedimage1675929700020v9.png

    List rows(Dataverse):

    pastedimage1675929689155v8.png

    Get and set record count for the list:

    pastedimage1675929923215v11.png

    Condition:

    --under Yes branch, 'Update a row(Excel)' to update Flag column:

    pastedimage1675930083272v12.png

    Save and Test:

    pastedimage1675930239990v14.png

    pastedimage1675930204891v13.png

  • Leah Ju Profile Picture
    Microsoft Employee on at
    RE: Best way to compare Excel data against Dataverse data?

    Hi shogg,

    Have any updates?

    Please feel free to contact me if you have any questions!

  • shogg Profile Picture
    39 on at
    RE: Best way to compare Excel data against Dataverse data?

    Hi Leah,

    Thanks very much for this suggestion, I appreciate the detail! I tried a variation of this yesterday and had mixed success.

    I had the flow update the spreadsheet in both the If Yes and If No branches of the condition, so when the flow succeeded I expected the "Flag" column to say either Yes or No. Initially I could see it was only processing 256 rows of the Excel sheet until I realized I needed to adjust a setting on the Excel step to allow for pagination. I set the threshold to 1000 since there are 777 rows in my spreadsheet. For whatever reason the default is 256 rows. (See https://www.c-sharpcorner.com/article/retrieve-more-than-default-number-of-rows-of-data-from-excel-using-power-automat/)

    The good news is the flow succeeded (after 22 minutes). When I look at the Excel, I do see both Yes and No values present and they seem to be accurate at first glance, which tells me my filters are probably good. However, more than half of the rows are blank. Only 348 rows have values, and it's scattered throughout (not the first 348 rows, for example). I can't tell why this might be. Since the flow succeeded, I don't think it timed out, and I've tried it multiple times with the same result.

    I confirmed:

    • The range of the table I'm calling looks correct
    • The List Rows output appears to be working; the "Apply to each" step shows 777 rows:

    pastedimage1676037992057v1.png

    Any ideas?

  • Suggested answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    RE: Best way to compare Excel data against Dataverse data?

    Hi shogg,

    Based on your screenshot, you used two 'Apply to each' actions: 

    pastedimage1676272675248v1.png

    How many lines are shown in the "Apply to each 2" step?

    Can you check if the subsequent steps are placed in the 'Apply to each 2' step? They should be at the same level as 'List customers'.

    My flow:

    There is no need to use 'apply to each 2' action:

    --we just need to get the number of records returned from the "List rows" step and don't need to do anything more with it.

    pastedimage1676273476624v3.png

    Can you share screenshots of all your steps?

  • shogg Profile Picture
    39 on at
    RE: Best way to compare Excel data against Dataverse data?

    Hi Leah,

    Thanks for your feedback! The second "Apply to Each" step is in there because my condition includes additional criteria. I'll explain in my screenshot.

    Some background first: I chose to adapt your instructions for something slightly different -- this flow is checking for Account records (we renamed the Accounts table to Customers) that already exist in our CRM, matching on "Company Name" in the spreadsheet. This posed two challenges. First, the Company name in the spreadsheet is sometimes a full name (example: Alpha Bet Company) and sometimes an acronym (ABC). For our customer records, we do capture both the full name and the acronym in the table, but these are two different fields. Second, I only want it to compare against customers where Relationship Type = Customer (customertypecode = 3). So, here is what I ended up with.

    First three steps are the same:

    pastedimage1676298778391v1.png

    Next, the Apply to Each step:

    pastedimage1676301283697v2.png

    Note that the filter step has an OR statement ensure both the Name and Acronym fields are being checked for a match on the Company column in the spreadsheet. 

    length(outputs('List_Customers_that_appear_on_the_Excel_sheet')?['body/value'])

    pastedimage1676303287970v9.png

    The next set of steps is contained within the second "Apply to Each" step. This is because I included a second condition here to account for including only CRM Customer records where the relationship type = 3 (Customer, instead of Prospect, Vendor, etc). Because the condition is referring to Dynamic Content from the "List Customer" step, the second Apply to Each step is forced. Originally I had applied this filter on the "List Customers that appear in Excel spreadsheet" step but that wasn't working. After the flow would run, not only were there still rows with blank values, but the rows WITH values were not accurate. Either the OData filter did not like both and AND and an OR condition or my syntax / order was wrong. In any case, when I made this change and moved the filter to the condition, this fixed the accuracy but did not fix the fact that rows were left blank. 

    pastedimage1676303211518v6.png

    For the last time the flow ran, the "Apply to Each 2" step shows this. It says "1 of 1", but I think that is because it is contained within the first "Apply to Each" step. As I toggle through from 1 of 777 to 2 of 777, etc, the "Apply to Each 2" step continues to say Show 1 of 1. 

    pastedimage1676303652741v10.png

    Looking forward to hearing your thoughts on this. Thank you for your help!

  • Suggested answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    RE: Best way to compare Excel data against Dataverse data?

    Hi shogg,

    The reason is that you set the condition inside the ''Apply to each 2'' action, only records that meet the 'List Customers' criteria can be run inside.

    --Out of a total of 777 rows, 348 could be returned from the 'List customers' action and then those rows would be updated to 'Y' or 'N', but the rest would be ignored.

    pastedimage1676352023367v1.png

    You should change it like this:

    --Separating the two conditions, Condition 1 must be outside the 'Apply to each 2'action

    pastedimage1676353510072v2.png

  • shogg Profile Picture
    39 on at
    RE: Best way to compare Excel data against Dataverse data?

    Hi Leah,

    I am happy to report that this worked perfectly after I made this adjustment. The data is complete and accurate. Thank you very much for your help!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 117 Super User 2025 Season 2

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 115

#3
Erin Lubben Profile Picture

Erin Lubben 66

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans