How to check if file extension is xlsx or not?

Hello Guys,

I have a file , I need to check its extension.

How can I do that?

Hi @Karan28

try this to get specific format files in directory Directory.GetFiles(folder_path,“.xlsx”,SearchOption.AllDirectories)`

1 Like

try like this path.getextension(file_Path) this will gives you file path extension and then check like in if condition path.getFileextension(file_Path) = “xlsx”



Use assign activity to get file extension.




I have applied this with the help of if statement but condition is giving false means going to else part

can you please share that screen shot here and what file you are checking if possible

This expression would help you resolve this

Cheers @Karan28

here var = “C:\Users\karan.arora\Desktop\TimesheetReportExtraction\data\User Input.xlsx\User Input.xlsx”


GetFileExtension will give us with . Along the file extension
So use contains like this

Cheers @Karan28

Thankyou so much , it worked

1 Like

Just In case one doubt, I am downloading the attachment using save attachment activity
I need to check the extension of that attachment and I am giving the folder path to save the attachment in save attachment activity.
I need to check if the folder contains xlsx file or not

yah with PATH EXISTS activity itself we can get that boolean output where mention the same file path so that it will tell whether its there or not
Cheers @Karan28

yes but I need to check the extension of that file , I dont know the name of the file
I need to check the extension of the file present in the folder and I know the folder path

I guess it will be done by directory.getfiles

1 Like

this would help you (2.2 KB)

Hello @prakaz25 I guess your solution is quite close.
I have the folder path and I am saving an attachment in that path and I need to check if the downloaded file in that folder is of xlsx or not?

did this help you


While saving itself you have check the file extension, as

Path.GetExtension("yourFilePathwithExtension") =".xlsx"

Hello , I Like this logic I am just implementing
I am not getting name after mails

Already Tried this sarathi125

So what you want to check then