Redaing data from different Sheets

Hello All,

I want to read the data from different sheets in same workbook, but i don’t know the number of sheets.
how can i do this ?

Thanks and Regards,
Parvati Thalal

Hi @parvati
Please refer to this post to know how to loop through sheets:

Hope this helps.
Thanks and regards :slight_smile:

1 Like

@parvati - Inside excel application scope → get the workbook object → In assign activity workbookobject.Sheets.count;
Example as in c#:
Workbook workBook = _excelApp.Workbooks.Open(“d:/Book1.xls”);
int numSheets = workBook.Sheets.Count;

Hello @parvati,
This might be helpful (the output of Excel Application Scope is variable “workbook”):
image

1 Like

i want to read the data from those sheets and paste it in some other excel.
but i dont know the exact number of sheets,so how can i do this using for each?

number of sheets available in that workbook i don’t know i want to iterate through for each…

Thnaks and Regards,
Parvati Thalal

@parvati,
This should work:

in read range what i have to specify?

Sorry a little mistake from my site. You need to assign “workbook.GetSheets” to variable of IEnumerable type, then in For Each loop your “item” argument needs to be also IEnumerable type. And rest of it as below on the screen:

@parvati Check attached zip file meets your requirement

ReadSheetDnamically.zip (33.2 KB)

1 Like

i want all the data to be pasted in same sheet,
not in different sheets…?

@parvati Check this xaml file file_from_allSheet.xaml (12.2 KB)