Hi,
I am using a Read Range activity to read an excel sheet. But the sheet name changes every month. let say this month its “August” and Next month the sheet name will be “September” like that.
How can we use the code without changing the sheet name in the Read Range activity everytime.
Regards,
Vikas_M
(Vikas M)
August 17, 2023, 9:04am
2
hey @raju_alakuntla
U can use get workbook sheets activity
Which will give you all the sheet names of the excel/Workbook
And then iterate through the sheet and do stuffs
or there is an Get workbook sheet where u have to give the index and it will return the sheet name present in that index position
Below is the screenshot of the activities
Hope it helps you out
hi @raju_alakuntla
place a variable in the sheet
var=Now.ToString (“MMMM”)
Gokul001
(Gokul Balaji)
August 17, 2023, 9:07am
5
Hi @raju_alakuntla
Try with this below expression in the Read range activity (Modern)
Excel.Sheet(DateTime.Now.ToString("MMMM"))
Classic
Regards
Gokul
Hi @raju_alakuntla
1. Get Workbook Sheets (Excel file) -> SheetNames (Array of String)
2. Assign:
CurrentMonth = DateTime.Now.ToString("MMMM")
3. For Each:
TypeArgument: String
In: SheetNames
Body:
If item.Contains(CurrentMonth)
Then
Assign:
SelectedSheetName = item
Break (to exit the loop)
End If
4. Read Range:
Excel file -> SelectedSheetName
OutputDataTable
Hi @raju_alakuntla ,
You can use get work sheet to get sheet name
It need index of sheet
in excel index from 0 is first sheet
Hi @leanhtuan221200 ,
You can use get work sheet
[image]
it return string is sheet name
Chào Tuấn, bạn dùng get work sheet nhé, nó cần vị trí của sheet thôi, sẽ trả về tên Sheet có thể đặt là strSheet,
ở hoạt động read range thì có thể gọi strSheet đó
filter data.xaml (9.7 KB)
regards,
LNV
regards,
LNV
system
(system)
Closed
August 20, 2023, 9:11am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.