How to create different different excel for each row

Hello All,I have a scenario where I want to create excel for each row. If I have 6 rows in Excel so I want to create 6 excel sheet. how we can achieve that.

Appreciate your help


welcome to UiPath community
hope these steps would help you resolve this
–use a excel application scope and pass the file path as input
–inside the scope use a read range activity and get the output with a variable of type datatable named outdt
–now use a build datatable activity and create a datatable of same structure of datatable that we obtain from the excel and get the output with a variable of type datatable named Finaldt
–now use a for each row loop and pass the variable outdt as input
–inside the loop use a ADD DATA ROW ACTIVITY and mention the datatable as Finaldt and Arrayrow as row.ItemArray
–now use excel application scope and in the file path mention as
“yourfoldername”+“\”+“yourfilenamewithoutextension”+“_”+now.tostring(“hh_mm_ss”)+“.xlsx” and this expression will create a new excel file for each time
-inside the scope use a write range activity and mention the datatable as Finaldt and enable the add headers property in the property panel of write range activity

–now still being inside the for each row loop next to this excel application scope activity use a CLEAR DATATABLE ACTIVITY and mention the datatable as Finaldt
so that for next iteration fresh Finaldt will be there and it will add the next datarow to that datatable and it would be added to the new excel file

hope this would help you
kindly try this and let know for any queries or clarification
cheers @Chirag1991

1 Like

This is probably similar to @Palaniyappan’s solution, but just to be simple here…
You can use Add Data Row to add each row within a For Each activity. Then, you’ll just need to decide what the filename will be for each file.

For each row In srcDT
    newDT = srcDT.Clone //this creates a table with same columns but no rows
    Add Data Row activity //use row in DataRow property, newDT
    newFilepath = filepath
    Write Range activity //newFilepath

EDIT: placed newDT inside ForEach so the table is reset each time

Hi thanks a lot for your response. So suppose if I have headers like,first name last name , number, email address they are horizontal but if I want them to make vertically and irrespective I want to fill the details how I can change the headers from horizontal to vertically.

hope this would help you

Cheers @Chirag1991

Thanks a lot will try this. If you could send a call file I will take help for the first scenario.thanks

We got an example In that thread as well
Cheers @Chirag1991

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.