Dynamic file name using string array variable

Hello UI,

I solved one of my critical problems that the excel files I download from a website have arbitrarily assigned names like “a31dfg21213dfasda”. I managed it by “processing last downloaded file”, using the variable below in the Excel Application Scope, copying the data from these “last downloaded” (reach scope with function below) excel files and pasting them to a new created file:
Directory.GetFiles(“C:\Users\hamza\Downloads”).OrderByDescending(Function(f) New FileInfo(f).CreationTimeUtc).First()

The problem is that I am repeating this action 15 times in which I have to create new files for the copied data coming from above function. So, I need a dynamic path like

( "C:\Users\Jack" + companyname ) in which there are 15 companynames as an array of string. Companyname = {“x”,“y”,“z”}
When I try to do it by a loop:
For each item in company name, Assign Fullpath = Path.Combine(Folderpath, item)
I get a Compiler Error saying that string array element cannot be changed to string element.

Need your help! Thanks you.

Could you please attach workflow.
Its just a matter of data type mismatch.

The error box says that " the value of the type of ‘string array’ cannot be changed as ‘string’ "
Edit: I changed Path.Combine(cpath,firmlist) to Path.Combine(cpath,item), still the same error.

Path.Combined returns on string so considering that
Path.Combine(cpath,item) should work.
Its working for me.
It would be helpful if you can attach workflow.
FolderPath.xaml (9.3 KB)

Here is my workflow
Main.xaml (6.4 KB)

You just need to change for each item type to string from the object.

Main (20).xaml (6.4 KB)

Yes it solved the issue. Thank you ddpadil.

1 Like