Excel split month and year from date

Hi All,

I want to separate month and year from Date column and write month in “Month” Column And Year into “Year Column”

MonthYear.xlsx (8.1 KB)

1)Build new datatable with 2 columns.
2)Read the excel store in datatable
3)In foreach row Split the row(0).toString with respect to / , assign the obtained arr(1) to month variable and arr(2) to year variable.
4)add row to new datatable created using build datatable activity use month and year variable in arrayrow property.
5) After forteach row Using write range, write the datatable to excel from B2 and uncheck add headers

1 Like

Getting_Month Year.xaml (8.6 KB)

Can you change into it

Main.xaml (10.3 KB)

See attached workflow

1 Like

I made a workflow on splitting month and year.
Main.xaml (9.0 KB)

1 Like

ok i will check it and let you know

Thank you

Thank You its working:grinning:

1 Like

Use Excel scope activity within it use get row item activity for the column u want to fetch the date after that
assign a variable
(for fetching day)
1.newdate= rowtext // output of get row item
2.newdateconverted = Left(rowtext.ToString,4)
3.fetchdate = newDate.ToString(“dd”)
similarly do for fetching month and year

1 Like

Hi …
Can you please develope it with updated excel file…

MonthYear.xlsx (8.7 KB)


Can u please update your workflow using updated file
MonthYear.xlsx (8.7 KB)

Change from row(0).tostring to row(2).tostring
For write cell just indicate the column letter which is D for month and E for year.
Please note that the datatable output column index is 0, so column A = 0, B = 1, C = 2, and so on…

1 Like

You just have to change Cells in Write Range from B & C to D & E that would work and Get Item Row column index would be 2 according to new file

1 Like

ok i will try it


Hi …
see in my file i m getting follwing result

please use my updated fileExcel.xlsx (136.2 KB)

please help with my file

Did you change the index of the datatable row?

@SagarSB check attached file is as per your requirement

SplitDateFromExl.zip (8.2 KB)

1 Like