I am having Excel sheet, From the sheet rows having values (1,2,3,4…) like this… I need to convert the value into Date format like mm/dd/yyyy (6/1/2018,6/2/2018 etc…) Can you please help me to break this logic.
I have not tested this but let me just provide you a quick idea on how to do this.
Let’s assume you run through each row in a For each, then you can manipulate the numbers to the desired date string (I would probably use a .Select expression here)
For row in dt1
Assign row(1) = System.Text.RegularExpressions.Regex.Matches(row(1).ToString, "[0-9]{1,2}").ToArray.Select(Function(dd) dd.ToString+"/07/2018")
I am not 100% confident I did the .Matches correctly. But, essentially, you want to set the string into an array of numbers, then concatenate the month and year to it for each number (which the .Select() will do if you create the Matches array correctly.) —you can also use the Matches activity, although I’m not sure how well it works.
Instead of Matches, you can also simply use a .Split(). The reason I didn’t mention it is because sometimes that solution requires some additional logic like checking if the delimitter exists.
Please note that you will have some variables to set in the XAML, such as excel file name and sheet name.
Also forgive me for the code’s messy look. Doing this kind of stuff with uiPath and not much time is not easy.
Try to give it a cleaning up whenever you can.