Comma into seprate rows

Input

input is like this as shown in input image

i want output as shown in output imageoutputi

  1. Build data table with 4 columns as per image 1 → dtOutput

  2. Read cell activity to read the cell value A2 and save to strInput
    Read other cells values → strStatus, strClass and strSubject

  3. Split the string → strArray = strInput.Split(“,”)

  4. For Each str in StrArray
    {
    Add row to a datatable dtOutput → str, strStatus,strClass and strSubject
    }

  5. Export the dtOutput to Excel.

Regards,
Karthik Byggari

5 Likes

could u please share workflow

1 Like

@Ananya1

Please find the workflow for your requirement. I am also attaching the excel file for your reference(check Sheet1 for input and Sheet2 for Output).

Note: Please change the excel file path as per your requirement.

@KarthikByggari - Hope this is what you meant.

Thanks and Regards,
@hacky

SampleExcel.xlsx (8.2 KB)

Main.xaml (12.1 KB)

1 Like

u have fixed cell in read range
It can be many rows
Input

and it not fixed that col A will contain ,
it can have only one number also

You need to try a bit by your self mate… You just need to use loop to iterate through rows.

I would suggest you to go through academy, its amazing… :slight_smile:

I think its not a goot practice of uploading the workflow…

It would be good if you can specify what you have tried, where you have stuck, what issue you are facing.

@Ananya1

Thats interesting, I shared a code with respect to what example you gave.

But anyways, this is possible, because, when you read cell(Value of RollNo), you can have track of number of roll numbers per cell.

Again, I assume that we have multiple values only in the case of RollNo, so its easy to keep track of the values in the Column “RollNo” and Add multiple rows with respect to it,.

Hope this makes sense to you.

Thanks and Regards,
@hacky

Hi @Ananya1
I gave you the steps assuming you have only row. If you have multiple rows please try the following. I recommend you to try the below in your studio and if you face any issues we will support.

  1. Build data table using build datatbale activity with 4 columns as per image 1 and name the datatable as dtOutput
  2. Read range activity to read the data from Excel and save the output to dtInput
For Each row in dtInput
{
   strArray = row(0).ToString.Split(",")
   For Each str in StrArray
   {
      //Add row to a datatable using Add DataRow Activty 
      dtOutput ->  {str,row(1).ToString,row(2).ToString,row(3).ToString}
   }
}
  1. Export dtOutput to Excel using Write Range Activity

Try to implement this in Studio.

Regards,
Karthik Byggari

1 Like

Error

Can you share the Add Row Activity properties screenshot

Please refer the example here how to add row to a data table -

https://docs.uipath.com/activities/docs/add-data-row

i want to delete that rows which contain commas

Use Filter Data table activity -

Give condition as → “RollNo” Contains “,” → Select Rows Filtering Mode “Remove”.

Rows Filtering Mode - Specifies whether to filter the rows by keeping or removing them. This can be done by selecting the Keep or the Remove radio buttons. Selecting Keep only keeps the rows that meet the specified condition, while selecting Remove removes the rows that meet the specified condition.

Refer -

https://docs.uipath.com/activities/docs/filter-data-table

Regards,
Karthik Byggari

Thank you @KarthikByggari

1 Like