I am working through the course and we are applying a Write Cell step. The action cannot be completed due to the following exception below. If I close the Excel app, it will update it, but if it is running on its own, it will not update while it’s left open.
Are there any solutions to this? Thank you for your help
Write Cell Workbook: The process cannot access the file ‘C:\Users\CMRN\Documents\UiPath\AmprasFirstBuild\Invoices\Invoice 3.xlsx’ because it is being used by another process.
Before you run the process make sure to close the excel file. This error is raised due to that. You can’t see what’s being written if you go step by step too. If you want to see what’s being written have a message box below Write Cell Workbook and pass the same variable that you are passing in Write Cell Workbook. Whenever the message box appears you can see what is written in excel. Make sure to delete the same message box before you publish or submit your project.
Well that’s true
You can update the excel through bot only when only someone has saved and closed it
Here instead of using write cell workbook use EXCEL ACTIVITIES so that you don’t need to open and close once after every edit in the workbook as that is what is happening now
Have a view on this for more details
Before excel activity named USE EXCEL activity use a KILL PROCESS activity before that Excel application scope or Use excel activity
Where in ProcessName mention as “Excel”
It’s very important to ensure that the entire thing is contained within an excel scope? This will keep the file open until you say you wish for it to be closed. The error is popping up because you are closing/opening excel each time and that takes a long time, but the robot moves so fast that it tries to open it while the previous one is still closing, thus throwing the error.
U r using EXCEL APPLICATION SCOPE and passing the filepath
Then why u r using WORKBOOK activities like WRITE CELL WORKBOOK where again u r passing the filepath to update
Ideally u have to use EXCEL based activities and not workbook activities
There are two set of activities package to edit or read a workbook
Excel activities - this works only if excel app is there
Workbook activities - this works even if excel app is not installed
This is the basic difference
As you are opening the excel file with excel application scope inside that again you are trying to open it with workbook activity which will obvious throw that the file is already opened
You are using excel application scope
So let’s use only the excel based activities not the workbook
Search in activity panel as excel where you can see set of activities under the category called excel
Under that choose WRITE CELL activity and use it
Remove the write cell workbook activity that you had earlier
Inside the write cell activity you can mention the cell where u wanna write
Click on plus symbol in the field and mention the cell where u want to type the value