Read Range Sheet Index instead of Sheet Name

Hi Everyone.

I have many excel files in one folder… I want read one by one to extract data in all of files.

But in excel files… Sheet Names are different… but they have same Sheet Index “Sheet1” as below Picture.

I have to read range and call Sheet Index… How to do that ?

Thanks in advance!


1 Like

We can mention the sheetname only as a string buddy with the activities we have in uipath
May be we can get the sheetname from
arr_sheets = workbookvariable.GetSheets.ToArray()

Where arr_sheets is a variable of type array of string

And workbookvariable can be obtained from EXCEL APPLICATION SCOPE workbook property in its property panel

And now pass this array variable to For each activity
And mention the sheetname as item.ToString with Reda cell activity inside the for each loop

Cheers @trunghai

2 Likes

Hi Bro.

Thanks you so much.

But I don’t use Excel Scope Activity… I used For Each activity only to read one by one xls files in one folder… And I want to get “Sheet1” as below picture instead of Name of Sheet.

I can do this with one excel file… but don’t know how to do in this case :slight_smile:

1 Like

Hi if Sheet1 is there in all excel files then we can mention the sheetname as “Sheet1” in that read cell right

Or am I wrong with question
Kindly correct me if I m
Cheers @trunghai

1 Like

Hi Bro.
in Read Range, I don’t want to call Name of Sheet as below picture because xls files have name of sheet are different… I want to call Sheet Index “Sheet1”

Hi Bro.

The name of sheets are different…but sheet index is same… all of sheet indexes are “Sheet1”

Hi Bro.

This is my XAML file.TKN.xaml (21.5 KB)

Hi bro!
Thanks you bro… i have another way to resolve

great
Cheers @trunghai

i saw the xaml
you were almost done
start with index 0 for first value, that is for first sheet
Cheers @trunghai

1 Like

Hi bro!

My workflow has problem when i run… it is conflicted between For Each acitivity and Excel Scope activity… when i run it show alert “ the file xxxx is being opened “…

So, i have used VB script to change sheet name :)!

1 Like

Awesome
Cheers @trunghai

1 Like

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