How to add days in dattable column through looping kindly help guys

image

i need to add enddate column with 3 days and put in Run column how i will achieve it kindly help

1 Like

You can take a read range activity and Pass the range E1:E4 and select the Add Headers option from properties of Read range. Create a datatable as a output of this. It will store only end date value.

1 Like

Hi @Aravinthan,
Try the below approach:
1.Use Read Column activity to read data of End date column and store the result in Datatable in Dt
2. For each row in DT
Use DateAdd(“d”,3,Row) to add three days
3. Use Write Range or cell activity to write data in Run Column.

I hope this helps.

1 Like

@Aravinthan

Follow below steps to do this:

  1. Use Read Range Activity to read the data from Excel and will give output as dataTable and say ‘DT’

  2. Then use For Each Row Activity to itreate that dataTable.

              ForEach row in DT
                 Int32 index = DT.rows.IndexOf(row)+2
                 String newDate = DateTime.ParseExact(row("End Date").Tostring, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture).AddDays(3).Tostring("yyyy-MM-dd")
    

    Use Write Cell Activity and pass below
    Range: “G”+index.Tostring
    Value: newDate

2 Likes

Bro it possible to upload the xaml iam trying to write the cell has you told but pasting entire dataset … kindly help me with xaml file

1 Like

I have tried iam getting string is not proper format pls upload me xaml file it will be much help full

1 Like

@Aravinthan

Could you please show me screenshot of write cell Activity

1 Like

In excel find the exact formula. For eg. I believe you should use DATE function and add 3 to your date(E2). You can use write cell to directly Write this formula to excel.

1 Like

@Aravinthan
Can you check the attached file.
ExcelDateDemo.zip (7.9 KB)

2 Likes

image

PFS bro…

@Aravinthan

I said use Write Cell Activity but not Write Range Activity.

1 Like

Thanks so much bro :slight_smile: much appreciated

1 Like

Thanks so much I have got the solution…

1 Like

Hi @Aravinthan,

Did the provided solution work for you? I have the same requirement as yours but unable to complete.