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?


#1

RITM_4356463.xlsx (6.0 KB)


#2

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)


#3

hi @im_heathen

Check the below post

Thanks
Ashwin S


#4

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


#5

Hello @im_heathen,

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