Dynamic excel name and folder

Hi All,

I have a scenario where the excel directory and excel name is dynamic so i how do i pass the value in excel application scope.

1 Like

Whether you are downloading the files and storing it some where?..

No , file will be present before itself

  1. Take a String variable : strExcelPath

  2. assign strExcelPath value as seen in below screnshot

StrFileLocation : Location of excel

  1. Pass strExcelPath into Excel application scope


Thank you i will try and one more thing is file name ends with year and previous month so how to pass that value . For example its will be

Get the filename from the directory and apply the regex to get month year for the filename .
Use this below regex to get the “201910” from the filename,
To add it use below code of @ImPratham45 or @Palaniyappan

1 Like

“Monthly Report format_”+Date.Now.AddMonth(-1).Tostring(“yyyyMM”)+“.xlsx”


Hope these steps would help you resolve this
—in a assign activity mention like
arr_files = Directort.GetFiles(“yourfolderpath”,”Monthly Report format_*.xlsx”)

Where arr_files is a variable of type array of string
—now pass this as input to FOR EACH activity and change the type argument as string in the property panel
—inside the loop use EXCEL APPLICATION SCOPE and mention the input as item.ToString


If we need only the latest file from the folder with the report dated

To get the latest file alone

Str_input = Directory.GetFiles(folder_path,“Monthly Report format_*.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).ToList(0).ToString Now pass this as input to Excel application scope

Cheers @rpatil


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