Hello, I’m having issues with UiPath retrieving the latest excel workbook file (xlsx)
The code that I’m using is
String.Join(“”,Directory.GetFiles(“ file location”,“*xlsx”,SearchOption.AllDirectories).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1))
There seems to be no error with the the code but when compiling I get
Read Range: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.
Welcome to the forum
can you check that only this type of double quote is used:
I believe everything is in double quote
ok, now also we do see the end from statement within the box
unfortunately a first replication rnd did not provoke this issue
find some visualizations for Windows target framworks here
So as visualized above following did return the string / Filepath of oldest file
give a try at this statement if possible
Would the code then change to
String.Join(“”,Directory.GetFiles(“ file location”,“*.xlsx”,SearchOption.AllDirectories).First()
without join, have a cross check on the immediate panel screenshot
It seems your expression contains non-0x22 double quote as the following image.
Can you try to replace these double quotes with
Please also see the following post.
In windows legacy, it seems double quote is normalized and any double quote characer is accepted. However, at this time, in windows (.net6) ,in fact, only " (0x22) is accepted to express string literal. To make matter worse, it seems to occur only compiling. (Expression validator don’t raise an alert.)
FYI, the following is sample for reproducing. The first Assign uses " 0x22 and second Assign uses “ and it fails in compiling.
Sample20221013-2.zip (2.1 KB)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.