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 / handling duplicate lin...
Power Automate
Unanswered

handling duplicate line/item from excel to Sharepoint list

(0) ShareShare
ReportReport
Posted on by 431

Hello Power Users,

 

I'm building a flow where it reads data from an excel sheet and creates items in a Sharepoint list for each column inside the excel sheet. There is a situation where the excel might have some duplicates, for example

 

No.           Department.            Issue Description     

1.                      IT.                     Login issue

2.                      HR.                   Access issue

3.                      IT.                     Network connection

 

In such cases I would like the Sharepoint list item created as

 

Department.                  Issue description

IT.                                      1.Login issue

                                        2.Network issue

 

HR.                                    Access issue.

 

Is this possible to have the duplicate records to be created in single line/item in sharepoint list?

 

Any suggestions or help please?

 

Thank you so much in advance!

Categories:
I have the same question (0)
  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at

    Hi @KrishR ,

     

    It seems to be possible. Just to confirm: your goal is to enter this items in SP List in a same same record and in a same column as text values, right? If yes, would you prefer single or multiple line of text?

  • KrishR Profile Picture
    431 on at

    Hi @rzaneti ,

     

    Thank you so much for the quick response. Yes, would prefer them in text values. Anything should be fine unless they are separated by something to show there are multiple issues for that department.

     

    May be separated by; or a period or numbering like 1.2.3....

     

    Thank you so much again 🙂

  • Verified answer
    rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at

    Hi @KrishR ,

     

    I got a solution for you! This is not the best flow design (it is a little long) and you probably will be able to improve it in the future, but it can be a nice start.

     

    Table and List overview

    This is the Excel Table that I'm using in this example:

    rzaneti_0-1689263019581.png

     

    The goal is to populate this List:

    rzaneti_1-1689263055436.png

     

     

     

    Step 1 - Get data from Excel:

    Use the 'List rows present in a table' from Excel connector to get all records from your issue table:

    rzaneti_2-1689263138965.png

     

     

    Step 2 - Initialize variables:

    You will need to use 3 variables during the process: a string, an integer and an array. Initialize them right after the 'List rows present in a table' action, assigning '1' as value to the integer variable (the other 2 variables may be initialized without values):

    rzaneti_3-1689263199044.png

     

    The variables will be used for:

    String - Build the "Issue Description" record to insert into SP List

    Integer - Count how many issues each department have and include the "X." before each issue description

    Array - As we have one record per department, this variable will store the departments that were already inserted into the List.

     

    Step 3 - Loop table records

    Finally, we will access each table record to extract its data. Use an 'Apply to each' loop passing the 'value' from Excel action as input:

    rzaneti_4-1689263275842.png

     

    Step 4 - Identify department

    Inside your loop, use a 'Filter array' action passing the array variable as input. In the conditions, include the expression item() (highlighted in yellow) and compare it to the department of the current loop iteration. The idea here is to check if we already inserted into SharePoint the department from the current Excel iterated record.

     

    After the 'Filter array' action, add a condition to identify if its length (highlighted in green, expression: length(body('Filter_array')) is equals to zero. 

     

    rzaneti_5-1689263565247.png

     

    The length will be equal to zero only for those departments that was not inserted into the SP List yet. So, if we already inserted the department in the List, we can skip to the next iteration. 

     

    To replicate it in Power Automate, let the "If no" block from your conditional blank. In the "If yes" block, append the department from the current loop iteration to your array variable - so in the future iterations of the same department, the flow will ignore it.

    rzaneti_6-1689263806154.png

     

    Step 5 - Capturing all issues from department

    After append the department into array variable, you will add another 'Filter array' action (highlighted in green), but at this time you will be filtering the 'List rows present in a table' value. As a filter condition, set the 'Department' to be equal to the expression item()['Department'] (highlighted in yellow):

    rzaneti_7-1689264062229.png

     

    It will generate an array containing only the records from your Excel table that matches to the current read department. 

     

    Step 6 - Looping each issue from department

    Now you will use another 'Apply to each' loop, but at this time you will be using your Excel table filtered array, from the previous step, as input. Inside this loop, you will have only 2 actions: (1) append a text to your string variable and (2) increment your integer variable:

    rzaneti_8-1689264208703.png

     

    In the 'Append to string variable' action, we are building a dynamic text where we are first including a number (highlighted in yellow, expression: string(variables('counter'))), then including a single dot "." (highlighted in pink), then including the issue itself (highlighted in green, expression: item()['Issue Description']) and finally letting a blank space at the end (highlighted in blue). 

     

    This expression will generate a text like "1. Network connection " and connect it to "2. Access issue ", and so on. The counter is used to capture the "1", "2" and so on; that's why you need to increment it in each loop iteration.

     

    Step 7 - Insert record into SP List:

    Finally, let's insert your record into SP List! Out of the internal 'Apply to each loop', add a 'Create item' action and pass the Department as department and your string variable as 'Issue description':

    rzaneti_9-1689264499576.png

    Note: in my List, the logical name of the 'Department' column is 'Title'.

     

    Step 8 - Clear integer and string variables:

    As a final step, still inside the "If yes" block, you need to clear the integer and string variables, so they can be properly used for the next department. Use two 'Set variable' actions, assigning the expression null to the string variable and '1' to integer variable: 

    rzaneti_10-1689264600284.png

     

    Output:

    The flow runs properly:

    rzaneti_11-1689264682144.png

     

    After running the flow, this is the output in the List:

    rzaneti_12-1689264704212.png

     

     

    Let me know if it works for you or if you need any additional help!

     

    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

  • Verified answer
    KrishR Profile Picture
    431 on at

    Hi @rzaneti ,

     

    That was so helpful. Appreciate your time and detailed explanation. Each and every step was clearly mentioned, thank you so much.

     

    The only step I was confused with the last Foreach loop from the final image(Output:). Can you please help me with expanding the For each loop here so that I can have a clear idea of the actions from Step 6. Do they all go under the Yes condition? Can you please help.

     

    Thank you so much !

  • Verified answer
    rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at

    Hi @KrishR ,

     

    I'm happy to know that it works!! About the 'Apply to each' loop from the output, this is the expanded view:

    rzaneti_0-1689281860709.png

     

    In red, you have the same 'Apply to each' loop that was collapsed in the first image. This is the external loop and the conditional with the 'If yes' block (marked in yellow) is inside it. The internal 'Apply to each' loop (the Step 6 one) is inside the 'If yes' block, and marked in green. 

     

    Let me know if it works for you or if you need any additional help!

     

    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

     

  • KrishR Profile Picture
    431 on at

    Hi @rzaneti ,

     

    I figured out from your explanation. Thank you for the detailed image and for your time and patience. 

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard