I am having an excel file,how to get the name of the file and store it in a variable and display it in a message box?

RITM_4356463.xlsx (6.0 KB)

Hello @im_heathen

You need to know the folder name in which the file is present.

Let’s say the folder name is “folderName”

Directory.GetFiles(folderName) will give you an array of files present in that folder. You can iterate through this and store its elements in string variables. After this you can use Path.GetFileName to get the file name
PFA the sample workflow
filenameSample.xaml (7.3 KB)

1 Like

hi @im_heathen

Check the below post

Ashwin S

1 Like

How can i remove that extension alone from the file name??

Hello @im_heathen,

Instead of using Path.GetFileName, you can use Path.GetFileNameWithoutExtension :slight_smile: