Read range mutiple exel sheet

Typical HF daily order.xlsx (26.1 KB)

Hi, I am working on my school project and it requires us to use read range activity to read multiple exel sheets and input them one by one into the form. I have successfully used the read cell and read range activity to do it for one sheet only.
I tried using the for loop but it did not work well.

i have changed the type argument to string, variable type for the forloop is IEnumertable. when i run, It loops itself but only for the first sheet(the one which i read range the files)
so all forms submitted is the same. My last step in the for loop is pressing the “submit again button”
please be specific and use easy language because I am very new to uipath, only learn do while, while and datatable activity.

1 Like

Hi @ragingdragon,

Using For each is Ok i guess. First of all you can use Get Workbook Sheets activity and use the output variable of this in For Each.

I think, you can read all the documents but in for each, it is overwriting the variable all the time (Updating the datatable variable). So when you submit it always read last sheet.

First read your sheet than submit the form and loop this logic. I think it will works.


1 Like

For Each Sheet does this for you, loops through the sheets.

You need two datatables. One master, and one that is used by Read Range. Each time it loops and you Read Range again, the data is overwritten. So Read Range into tempDT, then merge into finalDT.

i have added the read sheet activity. Currently in the body of for each, i have both read range and submit the form activity, the loop is able to repeat itself five times but it is only for the first sheet. Is it because for the read range activity inside the for each loop, i have input the sheet name for first sheet and thats why values are only retrieve from that sheet?

Hi @ragingdragon,

In my case, I created a sequence for your request, you can see that I read the excel where I used two for each to extract the header invoice and the data from each sheet.
Moreover, I created 3 data table where the first data table is to save the information of each header for each sheet, the second data table is to temporality save the data information and the other one is to merge all data information for each sheet.

For example:

  • Data Tables:

  • Read Excel and extract sheets to loop:

  • For each cell extract cell and prepare data:

  • Prepare data to merge to final data table.

READ EXCELS.xaml (26.8 KB)

Have a great day!
Please let me know if you need anything else.

Yes. Don’t specify the sheet name. Use CurrentSheet from the For Each Sheet activity. That’s what these variables are for, they represent the current object in the loop.

1 Like

It works :grin: :grin:, thank you very much sir!

1 Like