Opening excel files in automation flow where the excel file name gets updated and desired excel file should be opened

Hello everyone,
I have a scenario where I have to trigger a process from python script (Displayed in image below)


which triggers a flow on my studio to launch the excel file
image
My objective is to trigger the flow to launch excel files dynamicaly as new files are added to the folder.
Thanks for any suggestions
Nitesh

1 Like

Hey @nitesh.chouhan24

You should create arguments in your main file that will receive data which you need to pass the excel file path as job arguments from python script.

Thanks
#nK

1 Like

Hi @Nithinkrishna
Thanks for looking out but can you elaborate the steps like which activity should be used in the flow and fow to pass the file name as argument dynamically?
Thanks
Nitesh

1 Like

Sure @nitesh.chouhan24

So first please confirm the dynamic path is created at which point ?

In the python script itself or from the UiPath flow ?

Thanks
#nK

1 Like

@Nithinkrishna
Yes a dymanic path with excel file name is created everytime before the runjob() function i mentioned in the question.
Your file ‘Internal_test’ has been saved at your local file system location:D:\learning\Automation\Internal_test.
I have to open that particular file which is saved

1 Like

Hey @nitesh.chouhan24

So how are we going to know the file path will it be available in a variable in your python script?

If not how are you identifying it manually at present?

Thanks
#nK

1 Like

@Nithinkrishna
the file path is saved in a variable presently in my script.
At present I’m not able to open dynamic file names so while writing the new file I save it as project.xlsx and I have hardcoded the file name as project.xlsx in studio too.
So everytime a new file is generated it replaces the old file and the studio opens it after the flow gets triggered.

1 Like

Hey @nitesh.chouhan24

In your script you are using startjobjson right

Thats where you need to pass arguments

  1. Create arguments in main file with some name

  2. The same argument should be passed from the above json under args property

You can refer to swagger for experimenting the same.

Thanks
#nK

1 Like

Hey @Nithinkrishna
Im not able to follow the step you mentioned. In startjobjson even if I pass the file name and location how should I take that value in the sequence of start process in studio?

1 Like

Hey @nitesh.chouhan24

You will need to create arguments at the main xaml file & you need to pass the same name with value from the script.

That way you will receive it in the automation code.

Thanks
#nK

1 Like

So I have modified my main.xaml file and my flow takes an argument which should be an excel file path for my scenario


so in my script I’m passing my file path argument in this format

which returns json decode error, I can’t figure out what I’m missing here.

1 Like

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