How to close workbook and move file into folder without using Kill Process?

Hi,

I am creating a workflow that will:

  1. Copy & Paste data from a Data excel file to a Master excel File. (No Issue)
  2. Check if the Data excel File is a duplicate (Yet to be done)
  3. Rename & Move duplicate excel file/completed file after to another folder (Issue)

Once, I have completed copying/pasting the data to master file, I am not able to rename the file as the workbook is still open (Error: The process cannot access the file because it is being used by another process).

If I kill the process (excel), an error of “RPC server is shown. I believe this is because I still require the excel files for other data files.”

Previously, I moved the rename activity outside of the Excel Process Scope (containing all activities) which worked if there are no duplicates, but I do not know how to implement the renaming of file when there are duplicated files.

I am using Studio 2022.10.5

Hi @angelico_mdc,

Once you find that the data file is a duplicate file, just set the flag(take one Boolean variable) to true.

Now outside of excel scope, check if the flag is true then do the rename and move activities else nothing.

Regards
Sonali

@angelico_mdc

If there are duplicates or no move/rename would still remain outside

if you dont know before hand if it is duplicate or not then use get files with names and check how many files are there and use that to get the count of files and use the number to rename

cheers

Hi @sonaliaggarwal47 ,

Thank you for the reply.

May I know what you mean by setting the flag?

Use a if-activity to check if the boolean variable is true. Put the rename and move acitivities in the “then”-section, leave the “else”-section empty.

Hi @angelico_mdc,

By flag I mean, take a Boolean variable and do below:

  1. before entering into excel scope , set that variable to false.
  2. now within excel scope, check if data file is a duplicate one, if yes, set that Boolean variable to “true”. Else do nothing.

Now after exciting excel scope, check the value of that Boolean variable. If it is true, means data file is duplicate one and you would go on with rename and moving same into diff folder, else the usual flow(whatever you want to do if it is not duplicate).

Regards
Sonali