Loading xls or xlsx

Hi!

I'm trying to figure out what file extension a file has before load statement. The file is provided by users and sometimes they use .xls and other times .xlsx, so I need to alter loading depending on extension.

Right now the closest to a good solution is two load scripts and supress errors with

set ErrorMode=0;

But I would like a more flexible solution, perhaps an IF-statement? Check filelist?

So depending on the extension you load each format. The code still seems to me too complex, and some directory recursion might not be needed, or even just an If() will do, since you only want to load one file and there is no need to use a For loop...