Excel split month and year from date


#1

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)


#2

@SagarSB
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


#3

Getting_Month Year.xaml (8.6 KB)

Can you change into it


#4

Main.xaml (10.3 KB)

See attached workflow


#5

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


#6

ok i will check it and let you know


#7

Thank you


#8

Thank You its working:grinning:


#9

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


#10

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

MonthYear.xlsx (8.7 KB)


#11

hi…

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


#12

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…


#13

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


#14

ok i will try it


#15

thanks


#16

Hi …
see in my file i m getting follwing result
DAte


#17

please use my updated fileExcel.xlsx (136.2 KB)


#18

please help with my file


#19

Did you change the index of the datatable row?


#20

@SagarSB check attached file is as per your requirement

SplitDateFromExl.zip (8.2 KB)


Excel date format to message box
How to convert datetime(1/21/2018 00:00:00) into date(1/21/2018)