How to change the excel sheet names

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,

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
image

Hope it helps you out

hi @raju_alakuntla

place a variable in the sheet

var=Now.ToString (“MMMM”)

Hi @raju_alakuntla

Try with this below expression in the Read range activity (Modern)

Excel.Sheet(DateTime.Now.ToString("MMMM"))

Classic

image

Regards
Gokul

image
image
Regards @raju_alakuntla

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


regards,
LNV

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