I want to read excel present in one folder and store result of all excel in one table how to do it in Uipath

I want to read excel present in one folder and store result of all excel in one table how to do it. For loop and read range till that its fine. But when I need to update all tables in one result tables.

Hi @jast1631

β†’ Take an assign activity and create a Bool_Flag variable which is boolean datatype.

- Assign -> Bool_Flag = True

β†’ Use for each file in folder activity to iterate the each file in the folder.
β†’ Inside for each insert the Read range workbook activity to read the each excel and store in a datatable.
β†’ After that use If condition to check the Count.

- Condition -> Bool_Flag = True

β†’ Inside then block insert the Write range workbook activity to write the datatable to excel and check the add headers option in properties.
β†’ After write range workbook activity insert Assign activity.

- Assign -> Bool_Flag = False

β†’ In Else block insert the Append range workbook activity to append datatable to same excel.

Note : Give the Same file and sheet name in both Write range workbook and append range workbook activity.

Hope it helps!!

@jast1631
Create a new datatable in my example it is HeadersDatatable

Use Build datatable and remove all columns it must be empty
Use Merge Datatable activity to merge all data in one excel

Hi @jast1631

At start of the process Use Build Data Table and store the output say Final_Dt. After that use For Each File in Folder use Read Range Workbook and pass CurrentFile and pass the sheet name and store the output in datatable say dt_datatable. After that use Merge DataTable activity to append the datatables.

Hope it helps!!
Regards

Hi @jast1631

β†’ Build DataTable
image
Output: Final_Dt
Follow the process in below image.

Regards

Can you show me syntex

Hi @jast1631

Check this:

Regards

Check the below Process… @jast1631

β†’ Take an assign activity and create a Bool_Flag variable which is boolean datatype.

- Assign -> Bool_Flag = True

β†’ Use for each file in folder activity to iterate the each file in the folder.
β†’ Inside for each insert the Read range workbook activity to read the each excel and store in a datatable.
β†’ After that use If condition to check the Count.

- Condition -> Bool_Flag = True

β†’ Inside then block insert the Write range workbook activity to write the datatable to excel and check the add headers option in properties.
β†’ After write range workbook activity insert Assign activity.

- Assign -> Bool_Flag = False

β†’ In Else block insert the Append range workbook activity to append datatable to same excel.

Note : Give the Same file and sheet name in both Write range workbook and append range workbook activity.

Check the below workflow for better understanding -

Hope you understand!!

1 Like

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