Return a folder path in a variable

Hi guys

I have a workflow in which there are several Xaml and they have in common the path of a folder as it was able to create a variable that contains the Path and then it can concatenate the name of the file

Example

the path I have is like this "C: \ Users \ folder1 " + “file1.xlsx”
what I need is Variable + “file1.xlsx”

I have tried to store the route in an excel and create a directory but also fails me can give me a clue how I can do this
thanks as always for your help

Could you please provide some more clarity?
Based on what I understand, you have the full file path and you want to get the file name from it.

If you have a variable file path with the following value

var filePath = "C:\Users\Desktop\file1.xlsx"

you can get the file name using the expression below

var fileName = System.IO.Path.GetFileName(filePath)

1 Like

You can use like below
Path.combine( variable,file1.xlsx)

Where as variable define as below

Buddy @cristian_urrego

You were almost right buddy
you must need to add a backslash between the variable and “file.xlsx” buddy
like this
if the path you have is like this
in_Variable = "C:\Users\Folder1"
where in_Variable is of type string and is assigned from excel with excel application scope, read range and for each row loop to iterate through each row and inside the loop you can use this assign variable buddy in_Variable = row(“Columnname”).ToString

Then use like this buddy with a variable named final_path of type string that concatenates
final_path = in_variable+"\"+“file1.xlsx”

Thats all buddy you are done

Cheers @cristian_urrego

Hello @KannanSuresh
Thanks for your prompt response . what I have is an excel in which alamaceno part of the path of a file which I try is to bring in the other workflows so that when the route changes it is changed only in the excel and not in the different flows of I will attach what I have and I can give you a clue how to do it

image
image

This error is generated, but if I enter the full route it runs well

Hi, @Palaniyappan Thanks for your answer, I have tried it in that way but it generates me an error

Datos.xlsx (9.6 KB)
Rutas.xaml (9.0 KB)

1 Like

Buddy @cristian_urrego

you don’t have that column here in this excel buddy


Thats why buddy

is this the excel you are referring or is there any other file you are referring in get row item activity buddy @cristian_urrego
Cheers

@Palaniyappan if it is another excel . Datos excel is where I plan to store the route to be called in the other workflows that I have

In this flow, when you tried to call the path that is stored in the Excel Datos , I get the error

When I enter the full route, it runs without problem

Buddy @cristian_urrego,
Usually when you are trying to use excel application scope, and if you mention the file path which already exists no worries, it will open that excel and do the activities as mentioned inside the excel application scope like read range and write range or any activities
but if the file path that you mention in the excel application scope is not available in that folder path you mention, then it will create a NEW FILE buddy, with NO data buddy…then how the column name you have mentioned will be there in this new excel…thats why you were getting correctly if you are mentioning full route as that file was already there with data…thats what it shows buddy
image

Cheers @cristian_urrego

1 Like

Still any issues buddy @cristian_urrego

1 Like

If friend @Palaniyappan excuse me but I do not understand what you say in the excel application I give you a specific file route what I’m trying to do is that part of that route is stored in the data excel and that you can call it every time require In this case I create the excel I save the route and I convert it to a string of characters it would remain as a variable but it generates an error if I place the complete path the program runs and places a write line to see what data it showed as output and shows the route but I think it’s generating a space for me and that’s why the error

I do not know if this is the fault since I understand what I’m doing is passing a DataTable to String

image