Dear UiPath community
I developed a Robot that reads info from Excel A and pastes them into Excels B and C.
In order to read Excel A I use “Select File”, but in order to use Select File, Excel A needs to be closed, otherwise the Robot returns an error.
What is a workaround to let me use “Select File” while at the same time keeping Excel A open?
Thanks a lot for your help
If you can’t read the Excel file because it’s open, then it’s because you are using the Workbook Read Range instead of the Excel Read Range. So, use an Excel Scope and the Excel Read Range, and it should allow you to read the file while it’s open.
Thanks a lot for your reply. Actually I reformulated the question to be clearer. Please find a test robot in attachment that clarifies it even better.
If you open the Excel file you won’t be able to run the robot.
GennaroRobot Test.zip (8.5 KB)
Oh ok. I’m confused… How come you are using the “Select File” activity?
If you want the Excel data in the other Excel files, I would recommend using the Excel activities with an Excel scope so it can be open while you read the data. And, you can append that data in various ways.
You are also using the Workbook Read Cell to get the Project Name. Like I said, if you use the Workbook activities, the file can’t be open. If you use an Excel Scope with the Excel Read Cell, it will let you keep the file open.
If I could understand what you are wanting to do, maybe I can provide additional suggestions.
Oh I see, you are using the Select File to determine the file name that you want to read.
I would recommend using an Assign activity, like this:
I may have done that wrong…
You can do a search on these forums for further .GetFiles() examples.
thanks a lot for your support, that’s great. The fact is, I need to use “Select File” because the file is not always the same! The user of this process needs to select this file first.
I cannot use assign activity, I cannot hard code the file.
Yeah, I understand. If you look in the Assign activity I showed above, it uses the exact same pattern you are using in the Select File activity, so it’s not hardcoded.
thanks for your reply. Sorry but the user really needs to start this process by selecting the file she/he wants anywhere on the computer.
I honestly did not understand how my user can select anything with “assign activity”. If you would like to send me an example, then with pleasure.
Hi Clayton, I just re-edited the post to be clearer.
My apologies, I understood incorrectly… you are needing a Select dialogue to choose the file.
It appears that it might be by design that you can’t choose the file while it’s open. I don’t know how to get around that. Maybe you could close the file first. I’m not that knowledgeable with the Select File functionality, unfortunately.
thanks for the efforts and the interest anyway. As you concluded yourself, this goes back to the post subject “how I can select this file while the file is open”.
Hi @Gennaro_Bozza, could you explain your question again?
I downloaded your project, open Robot text.xlsx, run the robot, then selected the currently open Robot text.xlsx.
The robot threw an error, but the error was from Find Project Name (which is a Read Cell Activity).
If I am understanding correctly, then the problem lies in reading the Excel that is already open, and has nothing to do with Select File (even when I hardcoded the path in Read Cell without using Select File, it will threw error since the Excel is open). So the question had to be how to Read Excel while at the same keeping that Excel file open?
Seems like this
Select File, Excel A needs to be closed, otherwise the Robot returns an error.
is not happening on my side. I selected Robot text.xlsx finely.
Am I missing something?
You were right! Thanks a lot @whyyouandi!
Ooh. Nice to hear you solved it, @Gennaro_Bozza!