File extension recognition

Hello everyone!

I need to read all Excel files from a folder. How to filter them by extention or another way?

1 Like

Hey @chrestick

You can use Path.GetExtention(item) =".xlsx" or Path.GetExtention(item) =".xls"

For more assistance check this out :

Regards…!!
Aksh

3 Likes

when i am using this condition , its giving compiled error that “GetExtention is not member of system.IO.Path”.

Could you please suggest.

Path.GetExtension

Hey @Suchi3190

You have to import System.IO if Path is not reflecting in Uipath Studio Intellisense.

or

you can directly use System.IO.Path.GetExtension Directly as well but better to import namespace.

Regards…!!
Aksh

1 Like

GetExtension

1 Like

Forgot to mention…

More better way to do this is you can use

Directory.GetFiles(folder_path,".xlsx",SearchOption.AllDirectories)

Regards…!!
Aksh

1 Like

thanks @aksh1yadav , yes it works better :slight_smile: