i Have a input file by Name Opus_CK_10000023_$23.34.xlsx
how to i read this file dynamically whenever business send
starting of the file name will be same but numeric numbers may differ
Please suggest
i Have a input file by Name Opus_CK_10000023_$23.34.xlsx
how to i read this file dynamically whenever business send
starting of the file name will be same but numeric numbers may differ
Please suggest
When you say dynamically…do you mean when a new file is placed in a folder with this name then we need to read the latest file always?
If so…Use for each file in folder and use sort by creating date ascending and also filter can be used to filter on name of file
And inside the loop first will be the file you need and then use break
Also can use directory.GetFiles("Folderpath","filenamestatic*.xlsx").OrderByDescending(function(x) file.GetCreationTime(x))(0)
this will give the latest file path
Cheers
one file will come after reading the file i will move the file to another location…i dont want to keep there
Is the file placed in sharepoint?
If so you can have file triggers on it
https://docs.uipath.com/activities/other/latest/productivity/office365-trigger-new-file-created
Cheers
this seems to be tough is there no other way around it
Triggers are the only way you have…if you want it to be triggered always…
If not you run the automation for every few hours or so…and check if the required folder contains a file…if yes…then run the automation else end it without doing anything
Cheers
this code is bit difficult to understand can u make it simeple
Simpler would be this…the first option
Rather than making second simple I can explain
Getfiles will get all the files from given folder with the given filter on the name …
Next orderbydescending will order the retrieved files on creationdate from latest to old…and (0) will take the first which will be the latest file
Hope this helps
directory.getfiles(“ACB”,filenamestatic*) iam not getting the expression
directory.GetFiles("Folderpath","filenamestatic*.xlsx")
in this
directory.GetFiles - this is the function
Folderpath - this is the folder to be checked
filenamestatic*.xlsx - this is the expression to check.Here as I see its an excel file gave .xlsx at end…* represents anything can be present…and filenamestatic should be replaced with whatever you feel the filename starts with
cheers