How to separate rows with similar values to different excel files?

excel

#1

Hello,
I have been trying this , but not yet got the expected output.
I have a excel file with 3 columns .One of which is named as “Name” , which consists of some common names . I would like get all the rows with common names & put them in a separate excel file.
Eq: Input
Name Surname Balance
raj kumar 20
raj kumar 25
raj kumar 30
ravi singh 56
ravi singh 45
parth yadav 10
suresh moti 62

Here, I need all the row details of Raj in separate excel file. Similarly, with the rest of the names. All names in separate excel file.
Output:
raj.xlsx
Name Surname Balance
raj kumar 20
raj kumar 25
raj kumar 30

ravi.xlsx
Name Surname Balance
ravi singh 56
ravi singh 45

parth.xlsx
Name Surname Balance
parth yadav 10

suresh.xlsx
Name Surname Balance
suresh moti 62
Would appreciate any help with this. :slightly_smiling_face:


#2

You could do this with one foreach loop.

  1. Create an array that holds names.
  2. Check the name inside the excel sheet with the array.
  3. If this name exists in the array then add the row to the predefined excel sheet with that name.
  4. If not then create the excel sheet with that name, add the row and also add that name to the array.