Passing Excel Reference between workflows

Hi guys. I am building a robot containing more than one workflow to handle different Excel data files. For the final steps, I want to copy some sheets from the Excel files that have been edited in the previous workflows by specifying UNOutput.Sheet(“Sheet1”). However, it seems like the variable “UNOutput” is not declared though it has been used as an Excel reference in the previous workflow. May I know how can I solve this issue?

Thankyou very much for your help!

Hi @Komom

You could do the following:

  1. Create a Variable in the current workflow of the Data Type as same as UNOutput.Sheet(“Sheet1”)
  2. Create an argument (Out or In/Out) of the same Data type in the Workflow (the workflow where you are getting the UNOutput)

Use this argument to transfer the value.

May I know how can I create that variable? I thought a variable is already created when I input a name in the “Reference as” field.

Hi @Komom

Declare UNOutput as an out argument (e.g., out_UNOutput) in the previous workflow and pass it to the next workflow. Ensure it is imported and assigned properly in the invoking workflow.

To create a variable: Go to Variables Panel below, click Create Variable, set Scope and Type.

To create an argument: Go to Arguments Panel, click Create Argument, set Direction (In/Out/InOut) and Type

If it’s helpful pls mark as solution.

If this is the workflow where you have UNOutput and want to send it to another workflow, then create an argument.

We cannot crate variable directly in Reference as.

Go to arguments Panel and create an Argument and then use Assign Statement at the end of your Use Excel File Activity.

Refer:
STEP 1: In the External workflow, create an Argument of Type UiPath.Excel.IWorkbookQuickHandle, and Direction Out. Assign Excel to this Argument.

STEP 2: The workflow where you will be invoking the external, Create a Variable with the same data type

STEP 3: In the Invoke Workflow Activity Arguments Dictionary, Assign the Variable and save.

With this, you must be able to use the UNOutput between workflows

If this solves your issue, Do mark it as a solution.
Happy Automation :star_struck:

1 Like

HI @Komom

I also noticed one more thing. You are using Copy Sheet Activity. The SheetName property will Not allow the value UNOutput.Sheet(“Sheet1”).

You can directly give the Sheet name as a string.

If this solves your issue, Do mark it as a solution.
Happy Automation :star_struck:

Thank you so much for your help! I have now created and saved the Out Argument for the external workflow, but may I know how can I use this for my copy sheet activity? Because when I enter the UNOutput variable in the “Reference as” field, error occurs.
image

You can allow the default name Excel in the Reference as, then use an Assign Statement before the Copy Sheet.

Excel = UNOutput

Copy Sheet accepts String, so you have to directly mention “Sheet1”

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.