how do i verify the format of a file in the folder using the if else method?

  • 18 December 2020
  • 6 replies
  • 4 views

25573i63869D006F72E664.jpgI would like to get the name of the excel file in the format ".xls" only. but so far it will return me the file in the format "xls" and 

"xlsx". I have tried using the if method but it returns me files in xls and xlsx which isn't the outcome i want.

 

So far here is what I have done. I would like to use the if else command


6 replies

You can use the "match regular expression" condition inside the if statement, and then filter the string with .xsl extension only.

I have tried this method but still, it returns me all files. (Both xls and xlsx.) and not what i wanted which is only xls

I showed you an example of how you can check if the file is in the format you need.

 

In your case, you need to do a split to a single file, and then to check the file format in a loop.

You can use .xls

And use expression if contains xlsx

Reply