Copy Excel cell until next cell

Hi,

I have an scenario where the dates and serial numbers.

I have to arrange the dates in a order where serial number should be replaced by the date in the upper dates

Thanks in advance

@Rupesh_Parle

Use for each row in datatable activity

Inside place a if activity
Condition system.text.regularexpression.regex.ismatch(currentrow(“colunname “).ToString,”\d{1}”)

Gives you boolean output

2.then
Assign

currentrow(“colunmname”)=dt.rows(Cint(currentrow.tostring)-1).item(“columnname”)

else

Hi @Rupesh_Parle ,
Have you had solution
It is similar my way
input


output

Can you share your file, I will test it

Hi Rupesh

See below is the solution for your query. i also attached a zip file for your reference.
Let me know for any other scenario. Happy Automation.



TEST.zip (10.2 KB)

Hi @Rajnish_Arora ,

Thanks for the feedback!

It’s working as expected.

Just 2 things

  1. My excel has headers
  2. The values are getting ‘01/02/2023 00:00:00’ this format! I don’t want time in the values.

Regards,
Rupesh

Hi @Rajnish_Arora

You can try like this for removing the timestamp

Convert.ToDateTime(“01/02/2023 00:00:00”).ToString(“dd/MM/yyyy”) … So it will remove the timestap in it

Or else’s you can apply regex simply

System.Text.regularexpression.regex.match(“01/02/2023 00:00:00”,“\d{2}/\d{2}/\d{4}”).Value

It will output as 01/02/2023 this

@Rajnish_Arora

Hi @Praveen_Mudhiraj,

But i can’t hardcode the values

You can store in one variable and pass that value like this
Example :
Str_Text = Your_Text

System.Text.regularexpression.regex.match(“Str_Text”,“\d{2}/\d{2}/\d{4}”).Value

@Rupesh_Parle

Hi @Rupesh_Parle

Follow the below steps
=> Use the use Excel file activity and pass the excel file path.
=> Inside use Excel file activity insert the for each excel row activity.
=> Inside for each insert assign activity and create a variable let call it as Eachrowdata
→ Assign - Eachrowdata = CurrentRow(Sl No).toString
=> After assign take a If activity to check the condition.
→ If Condition - Eachrowdata.Count>1
=> In then block take an assign activity and create a variable and change the scope of variable to main sequence. Let call the variable name as RowData.
→ Assign - RowData = CurrentRow(“Sl No”).toString
=> In then block insert the write cell activity.
→ In the range field give like this CurrentRow.byfield(“Sl No”)
→ In the value field pass the RowData variable which contains the previous row data.

Hope it helps!!

Hi,

It is not going inside if condition as Eachrowdata count is 1.

Hi,

Can you help me by attaching the code(.xaml)

Hi @Praveen_Mudhiraj ,

Can you provide the code?