Same sheet name as excel name

I have a exel file, and I have single excel file in a folder but the name of the excel is dynamic, and the excel file name and sheet name is same always.

Like If I have excel file name is Aug11_Aug30.xlsm, It has the same sheet name Aug11_Aug30

so how to reasd the excel file name and store in a variable so that I can pass that variable in the read range excel file.

Note. I am not using any loop here. I am just reading the single sheet only. So is it possible to get the excel file name in the case of single sheet. @Palaniyappan @HareeshMR

1 Like

If you have a single file, retrieve it using Directory.Getfiles(“path”) and get the excel name as
filename = stringArray(0)

and use split activities to get the sheet name as

(filename.split("\“c).Last()).Split(”."c).First() @balkishan

1 Like

Yeah bro, I did this in this way.

1 Like

@balkishan :+1: great going bro :slight_smile:

@balkishan Use below code and check.

To get file path along with extension.

To get only filename with extension.

To get only filename without extension.

Hope these steps could help you resolve this
—use a assign activity like this
Out_filepath = Directory.Getfiles(“yourfolderpath”,”*.xlsx”)
Where out_filepath is a string array variable
—then use another assign activity and mention like this
Out_excelfilepath = Out_filepath(0).ToString
—and pass this Out_excelfilepath string variable as input to excel application scope and inside the read range mention as

Simple isn’t it

Cheers @balkishan

1 Like

Thanks @Palaniyappan This one one is also nice solution.

1 Like

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