Document Understanding - Creating Excel file and Referencing the same in the end of workflow

Hi Team,

Hope you are doing well. I need help please.

I am trying to build the workflow for invoice extraction using -Document understanding.

The issue is

  1. I am creating an excel file - Which extracts all the information from the invoice.
    The excel file is in the format - Sai_export - 20220714-093133 (with date time in the end)
    This is in the beginning of the workflow. The syntax is
    Path.Combine("\UiPath\Invoice_Recon\Email\Processing\File_Extract_Temp",String.Concat(“Sai_export - “,DateTime.Now.ToString(“yyyyMMdd-HHmmss”),”.xlsx”))

  2. In the later part of the workflow i need to use the same file. But when i am referencing the same file with Path.Combine("\UiPath\Invoice_Recon\Email\Processing\File_Extract_Temp",String.Concat(“Sai_export - “,DateTime.Now.ToString(“yyyyMMdd-HHmmss”),”.xlsx”))

Error - The path
image

Can you please let me know how can i reference the same file in the workflow?

Thanks for the help,

Regards,
Sri

Hello @srinivas_pradeep,

I believe the problem is that you’re still using the DateTime.Now.ToString(“yyyyMMdd-HHmmss”) - The time to the second has been written into the Filepath and can’t be referenced using the same syntax later on as the time will be different.

Consider writing the Path to a String variable before using it and passing this variable around to ensure you can constantly referenced it.

Best,

1 Like

Hello @srinivas_pradeep

Please store this value in a variable

Variable of type string FilePath = Path.Combine("\UiPath\Invoice_Recon\Email\Processing\File_Extract_Temp",String.Concat(“Sai_export - “,DateTime.Now.ToString(“yyyyMMdd-HHmmss”),”.xlsx”))

In the later part of the workflow pass this variable

1 Like

Hi @Cameron_McMahon1 ,
Thank you so much for the reply and help. Can you please help me with the syntax or example how can i do that please?

Sri

Hi @ushu ,

Thank you so much :slight_smile: Do you mean something like this?

@srinivas_pradeep please remove Inv_extarct =

1 Like

Hi @srinivas_pradeep,

Before creating the excel file at the beginning of the code;

str_MyExcelPath = Path.Combine(“\UiPath\Invoice_Recon\Email\Processing\File_Extract_Temp”,String.Concat(“Sai_export - “,DateTime.Now.ToString(“yyyyMMdd-HHmmss”),”.xlsx”))

Then use this variable to open or interact with the excel at any point throughout your automation and it should then work!

Best,

1 Like

@srinivas_pradeep Take assign activity

OuputFilePath (should be Before equals to) = Path.Combine("\UiPath\Invoice_Recon\Email\Processing\File_Extract_Temp",String.Concat(“Sai_export - “,DateTime.Now.ToString(“yyyyMMdd-HHmmss”),”.xlsx”))

Thank you @ushu . So this is the later part of the workflow where ia m referencing the same file. so instead of Path.combine is should give OutputFilePath?
Please let me know thanks

@srinivas_pradeep Correct. Instead of that complete path. Provide only that variable

1 Like

Thank you @ushu So should i remove the assign activity in my first workflow sorry i am not getting it


it says the outputFilePath is not defined.

Please don’t remove it @srinivas_pradeep

The first part is for store the entire path in a variable. So that this variable have your file path and that can be used when you want to access that file instead of giving the entire path

Please make sure you define the variable @srinivas_pradeep

Try this, click on the first assign activity, navigate to the variables panel, and search for OutputFilePath variable. Click on the scope and change the scope to your workflow name

Capture

1 Like

Thank you . It’s giving me only two options. which one to choose? the default was Sequence earlier.

Please choose BuildOutputFile @srinivas_pradeep

Let us know if you face any issues @srinivas_pradeep

1 Like

@ushu thank you.
Ran into different problem now :slight_smile: can you please help
now its not giving me any other option apart from sequence.

and then when i run the second part of workflow its giving me

if i use build output table as a option it gives following error

Can we quickly connect on this @srinivas_pradeep

1 Like