Import excel file along with file extension

I need to import an excel file for processing. I am using pub.file.getFile for this. The problem is that I have to specify the file extension along with file name. Is there a way I can get the file extension along with the file name without specifying it explicitly.

Thanks in advance.

Can you please shed some light on your question.

As far as I understand, you need to get the file without actually specifying the file name extension. You can use * while getting the file from a remote location which is a wild character that picks all the files from that directory.

For example if your file name is xyz_timestamp.csv then you can specify xyz_* which picks all the files in that format. Else * alone pick all the files irrespective of the format.

Thank you for your response. I need to branch based on the file extension for processing xls and xlsx files differently. Is it possible to extract the file extension from the file name if Iā€™m using the * character?

Well you can tokenize the file name to get the extension of it using string ā†’ Tokenize service. If your file name is xyz_timestamp.csv you can tokenize based on the delimiter ā€˜.ā€™ and the last index would be your file name extension. Based on that you can branch and write your logic to process the file.

Thanks a lot! That should do the trick.