Open a file using an Excel data row that contains the file names in UiPath.
@krishnapriya_Anu can you elaborate more, what do you want to do?
In My process I want To open the file one by one
Throght the Excel Data’s like (File Name)
Frist it will open the First (file 1) After the process
Open the Second file (File 2)
@krishnapriya_Anu Do you have folder path to open file or only file name is available?
Only File NAME
You can try the following logic in order to get the file’s path & then it will be easy to open the respective file.
→ Use the For Each activity & start iterating through the Excel file.
→ Use the following expression to get the file path of the using the current file name:
filePaths = Directory.GetFiles("C:\", currentRow(“File Name”).ToString, SearchOption.AllDirectories)
This will search in the entire C drive for the given file name & gets the path, if available.
→ Use an If condition to determine if the file was available & the path was obtained:
filePaths.Count>0
In the true block, get currentFilePath = filePaths(0)
& in the else block, place the Continue activity, as the file path for that file was not retrieved.
→ Once yoi have the file path, you can Start activities to open the file accordingly.
Hope this helps,
Best Regards.