Move Output file from One Drive to project: Cannot create a file when that file already exists

Hello RPA Dev Members,

I have a existing RPA BOT which takes files from one drive in to my project folder and processes them.
Recently i added one new functionality to the BOT where in it will take file “FileXXX.xlsx” from Onedrive into my project , write some info in it and transfer file back to Onedrive.
The idea is to keep on appending the data to this file.

This functionality works fine on my local.
But in the orchestrator run, I am getting error as below:
Move Output file from One Drive to project: Cannot create a file when that file already exists.

Has anybody faced this problem.
Any help is greatly appreciated.

You will have to use a new name for the file which you upload. You can append version number/date in the file name.

Alternatively, you can rename the old file or move the old file to some other location before you upload the updated file to OneDrive.
You can also delete the old file from OneDrive once you download it to your local machine and then upload the updated file without renaming any file. But deleting the file is not recommended.

Hi @ajagtap636

Before moving the file check wheather the file exists in Ondrive!

If exists then rename the file which is going to be moved!

Regards

Thank You for your response.

Please can you let us know why the file renaming is required as the file is not part of the project.
File is being moved from One drive in to project folder during the execution.

Thanks for your response.
Error is fixed when i am moving file from OneDrive to my Project folder.

But now the issue is in the outbound piece when I am transferring the file from my project back to Onedrive. Getting the below error:-
“write RPA data.xlsx” is the file.
The idea is keep on appending the data to this file after each BOT run.

Move Output file from project to One Drive: Could not find file ‘D:\Users\awsu1.svc.rpbot0030p.nuget\packages\RPA_change_Management_BOT\1.0.15\lib\net45\Outputfiles\write RPA data.xlsx’.

Hi @ajagtap636

If your idea is to append in the file after each run means check whether the file is there using path exists if exists then use append range to append the data else use write range to write the data

It will check each time if the path exits it will append the data or it creates a file name and write using write range!

Hope this will work!

Regards

This is solution works fine on my local machine.
But does not work once deployed to orchestrator.

i want append range to work because if i use write range all my previous data is wiped out.

Move Output file from project to One Drive: Could not find file ‘D:\Users\awsu1.svc.rpbot0030p.nuget\packages\RPA_change_Management_BOT\1.0.15\lib\net45\Outputfiles\write RPA data.xlsx’.

As you said “from my project back to Onedrive”. But a file with the same name already exists in OneDrive. Similar to the Popup what you get in your Windows Machine:
image

On UiPath, Move activity has a checkbox for override.Hence, there is no error.

For moving file to OneDrive, there is no checkbox neither any popup warning, hence, you will have to rename existing file in OneDrive of the same name before you add another file because OneDrive cannot have 2 files of the same name and moving the file to OneDrive does not replace the old file of the same name.

Hi Pawan,

Agreed with your explanation.
But in my scenario,
I am first moving the file from Onedrive into my project.
Processing it and then moving back to OneDrive.

As, I have taken file into my project , there should not be any file in Onedrive when i am trying to move the file back to it.

Thanks AJ

Once you move the file from One Drive to local folder using BOT, can you please manually try to upload file to OneDrive. Check if it still gives the same error or it works. If it gives the same error, it means it was copy paste not cut paste earlier.