To put the file path of an Excel file inside the path you provided into an Excel application scope in UiPath, you can use the Read Cell activity to read the file path from a cell in an Excel file and the Open Application activity to open the Excel file using the file path.
Here are the steps to do this:
Use the Read Cell activity to read the file path from a cell in an Excel file. Specify the path to the Excel file and the cell containing the file path in the Read Cell activity’s properties.
Store the file path in a string variable using the Assign activity.
Use the Open Application activity to open the Excel file using the file path stored in the string variable. In the Open Application activity’s properties, set the Path property to the string variable containing the file path.
Place the Open Application activity inside an Excel Application Scope activity to use the Excel file within the scope.
Below will give you the latest excel file in the folder.
Directory.GetFiles(Path+“",”*.xlsx").OrderBy(Function (d) New FileInfo(d).LastWriteTime).Where(Function (n) Not Path.GetFileName(n).Contains(“~$”)).Last