How to read only first excel from folder

I have multiple file like as
Excel1
Excel2
Excel3

want to read latest one.

this is my following code but its not work getting error please help:

please help :frowning:

Get the time stamp of the each file and pick up the file.

i am getting this error

, do u have sample code

1 Like

hi
out_folderpath = Directory.GetFiles(yourfolder_path,“*.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Take(1)

where out_folderpath is a string variable

Cheers @smita.mobifly

1 Like

if im keeping out_folderpath is string varible then getting following error:

1 Like

Fine
Kindly try with this @smita.mobifly
out_folderpath = Directory.GetFiles(yourfolder_path,“*.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).ToList(0)

1 Like

its working but it open excel into system.

i didnt get this buddy
@smita.mobifly

while i run this code open excel on system

disable the VISIBLE property in the excel application scope activity so that it wont show in foreground of the screen
Kindly correct me if i have understood the query wrongly
@smita.mobifly

1 Like

you are correct, thank you so much…:slight_smile:

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