How to get all excel names from a folder

For example i have ten excel files and i want to get all the excel file names

arrFileNames =
new DirectoryInfo("YourPath").GetFiles("*.xlsx").Select(Function (x) x.Name).toarray

mAY I KNOW IN WHICH variable i should store?

You can try this approach

create variable of datatype String( ) - an array of Strings
e.g. Variablename: arrFileNames


Try this

Assign strFolderPath = "Desktop\Input\"
Assign ArrStringFiles = Directory.GetFiles(strFolderPath,"*.xlsx")


  1. strFolderPath - String type
  2. ArrStringFiles - ArrayOfString type

Take one for each and pass the ArrStringFiles

You will get the one by one xlsx files


thanks for the reply nani but i want the excel name not the file itself and in which variable should i use to store in my variable?


In this case use like this

Inside the for each

strFileName = Path.GetFilenameWithoutExtension(item)

strFileName - String Type


thanks for the reply

1 Like

thanks for the reply

From this:

we get (FileNames)

we get FilePaths

we do feel that your question is answered and would ask you to close the topic
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum