If there are different month with year in a column how to change them to the constant format.
how to makes changes for the entire column
Can you share the sample input of the format that you have in Excel so that I can help you with the syntax.
Regards
If you need it on excel …then you can use format cells activity and select custom and give any date format you need
Cheers
Book1.xlsx (15.3 KB)
in input,input2,input3 sheets
the months Apr’22 should replace with 30/4/2023
may’22 should replace with 31/5/2023
like wise in three sheets the month should replace with date format (end date of month)
=> Read Range all three sheets are store it in three different DataTables.
=> Use For Each Row in Data Table to iterate through each row and in assign activity use below syntax
Str_date= DateTime.ParseExact(CurrentRow("month").ToString,"MMM'yy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")
Str_date is of DataType System.String.
You can use the same syntax for all three sheets by using For Each Row in Data Table for each Data Table.
Hope it helps!!
Try the below code it is working
DateTime.ParseExact(CurrentRow("Month").ToString.Replace("'", ""), "MMMyy", System.Globalization.CultureInfo.CurrentCulture).AddMonths(1).AddDays(-1).ToString("dd/MM/yyyy")
O/P:
Hope this helps!!
If i want for multiple sheets how to do?
looks like the cell does not contain a date at all…
you can do this…read the data into datatable and then use the below in ivoke code by sending dt as in/out argument
dt.AsEnumerable.ToList.ForEach(sub(r) r("month") = DateTime.DaysInMonth(DateTime.ParseExact(r("month").ToString, "MMM'yy", CultureInfo.CurrentCulture).Year,DateTime.ParseExact(r("month").ToString, "MMM'yy", CultureInfo.CurrentCulture).Month).ToString + DateTime.ParseExact(r("month").ToString, "MMM'yy", CultureInfo.CurrentCulture).ToString("/MM/yyyy"))
then write the data back to excel
cheers
what is the code in assign activity?
in your given input file and screenshot doesnot match
Please check on this xaml
There are 2 xamls in this file Sequence xaml is your code. Please ignore main xaml
like this,the date format should be there
cell should show apr’23 but the value inside should be date format
how to change like this?
how to do?this method
this is the method i want
did you try what we gave…as per screenshot the date is not last date of month…
cheers