Read the same cell from multiple spreadsheets

Hello,
I have multiple spreadsheets and I need to exract the information in the cell B9 from all spreadsheets and save it in an excel file. How can I do that ?
In For Each I add read cell activity but it reads the cell B9 from the first excel file only.
Somebody can help me ?
Thank you very much.

Hey,
you should use ‘for each’ activity for every excel file from the folder.
So for example you can do something like this:
image

edit.
argument for activity ‘for each’ please set as ‘string’
image
Directory.GetFiles("C:\ExcelFiles\ ")

2 Likes

Hi

Welcome to uipath forum

Hope the below steps would help you resolve this issue

  1. Use a assign activity like this

arr_filepaths = Directory.GetFiles(“yourfolderpath”)

Where arr_filepaths is a array of string variable

  1. Now use a BUILD DATATABLE activity and create a single column named Output of type string and get the output as finaldt
    Next to this build datatable activity use a Clear datatable activity and mention the input as Finaldt

  2. Then use a FOR EACH activity and pass the above array variable as input and change the type argument property as String

  3. inside the loop use a excel application scope and pass input as item.ToString
    Inside the scope use a read cell activity with cell range as “B9” and get the output as string variable named Strinput

  4. Now use a Add Datarow activity and pass the input in ArrayRow property like {Strinput.ToString} and datatable as Finaldt

So Your Finaldt will have all the B9 values in it

Cheers @mihaela.draghici

Thank you so much. It worked.

Thank you so much.

1 Like

@mihaela.draghici
I’m glad that it helped you. Could you mark ‘solution’ option on my post ?
Thank you :slight_smile:

2 Likes

Done :slight_smile: Thanks again.

1 Like

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