How to get only the numbers in the name of an excel file name?In the following workflow i have got the complete excel name,but i need to eliminate other characters and store only the numbers present in it in a variable


#1

filenameSample.xaml (8.5 KB)


#2

You can use Regex to extract only integers out of any string (filename in this case).

System.Text.RegularExpressions.Regex.Match(fileName, “\d+”).Value will give you the result in a string.

Please note that d+ is the Regular expression for an integer number.

PFA the xaml for your reference.filenameSample (1).xaml (8.8 KB)


#3

Thank you.Btw if i have a filename like “RTIM8372847284_Lokesh Raju” how can i get the “Lokesh Raju” alone??


#4

Well it depends whether or not your string follows a pattern. E.g. if the name of your excel always going to contain “_” (underscore) before the name, you can use something like -

yourString.Split("_".ToCharArray)(1).ToString


#5

Tysm.