How to split excel file?

AhmedSolmn

New Member
I have an excel file with a column named 'Status'. I need to split the excel file into 3 different excel files depending on what he value of the column 'Status' is. For example if 2 of the rows have a value of Valid or Invalid under 'Status' then the whole rows are saved to their own excel file, then if another 3 rows have the values registered or unregistered then they are saved to their own excel file and so on and so forth.

Any help is kindly appreciated.
 

VJR

Well-Known Member
Hi AhmedSolmn,

1. Are you going to know before starting the diagram which 3 statuses you need to split on?

If you know then what are they?

i. Valid, Invalid should go into ValidInvalid.xlsx
ii. Registered, UnRegistered should go into RegUnReg.xlsx
iii. ????

2. Do you need the rows in the split files to be exactly in the same order as in the Original Excel? Or is it okay to first have all Valid ones, then Invalid ones?

For eg, if original Excel file has below row.
Row1 - Valid
Row2 - Invalid
Row3 - Valid
Row4 - Invalid

Then how should the rows of VaildInvalid.xlsx be?
Option A:
Row1 - Valid
Row2 - Invalid
Row3 - Valid
Row4 - Invalid

Or Option B:
can they be?

Row1 - Valid
Row2 - Valid
Row3 - Invalid
Row4 - Invalid

Post as much details a possible while answering above questions.
 

AhmedSolmn

New Member
Hi AhmedSolmn,

1. Are you going to know before starting the diagram which 3 statuses you need to split on?

If you know then what are they?

i. Valid, Invalid should go into ValidInvalid.xlsx
ii. Registered, UnRegistered should go into RegUnReg.xlsx
iii. ????

2. Do you need the rows in the split files to be exactly in the same order as in the Original Excel? Or is it okay to first have all Valid ones, then Invalid ones?

For eg, if original Excel file has below row.
Row1 - Valid
Row2 - Invalid
Row3 - Valid
Row4 - Invalid

Then how should the rows of VaildInvalid.xlsx be?
Option A:
Row1 - Valid
Row2 - Invalid
Row3 - Valid
Row4 - Invalid

Or Option B:
can they be?

Row1 - Valid
Row2 - Valid
Row3 - Invalid
Row4 - Invalid

Post as much details a possible while answering above questions.
Thank you for the quick reply. I will answer your questions below. I have already found a solution but will give more detail to help others if anyone falls in the same problem.

To answer your questions:

The statuses are known and are,

i. Valid and Invalid go into ValidExcel.xlsx
ii. Registered and Unregistered go into RegExcel.xlsx
iii. Created and Not Created go into CreatedExcel.xlsx

The original excel file has no pattern to what the statuses are(any status can be in any row)
Both of the examples you gave above are both possibilities.

The solution I found is this:
Opening excel instance for original file and filtering the collection with collection manipulation as follows,
1522581484646.png
I filtered all six possible status' then ended the instance. Then merged each of the respective status' together.
Then started one instance each for the 3 new workbooks and saved as follows:
1522581647911.png
And thats that.

hope it helps someone. Or if someone knows an easier way to do this then please comment.
 

VJR

Well-Known Member
Hi,

Filter collection was the exact approach I was about to suggest you. But there is a catch in this method hence wanted to confirm your destination files. At first all the records of only the 1st filter (say Valid) will be copied to another Excel, then the 2nd (say Invalid) and so on. In the destination file these records will not be in the same order as the original excel file. For example, if the source file has the first row as Valid and the second as Invalid then these two won't come one after another in the destination file and that is the exact reason I enquired about the order. The order I mentioned above is not about the Source file but about the Destination file. If you are okay with all same statuses at first and then the next set of statuses, then you are good to go with this approach.
Good that you came up with the solution and have shared it for others' benefit.
 
I am trying to split the excel file based on location PFA excel sheet, In this case location names will not be fixed and also I am finding duplicates,

Please help me resolve this scenario. I am new to Blue prism
 

Attachments

  • Location.PNG
    17.2 KB · Views: 19
Top