File extension recognition


#1

Hello everyone!

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


#2

Hey @chrestick

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

For more assistance check this out :

Regards…!!
Aksh


Extension
#3

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

Could you please suggest.


#4

Path.GetExtension


#5

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


#6

GetExtension


#7

Forgot to mention…

More better way to do this is you can use

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

Regards…!!
Aksh


#8

thanks @aksh1yadav , yes it works better :slight_smile: