How to copy the same value in excel

Hi,

I have assign the value to get the today date as “DateTime.Now.ToString(“yyyy/MM/dd”)”
used excel application scope
read the excel–DT1
DT1.rows.count-Rowindex
finally used the write cell. in range “A”+ Rowindex.Tostring
In value i passed the date format.
i want same output value for A2,A3,A4…
But am getting the expected output…
Plz suggest me to resolve this…

Hello @vaish,

Here is what I recommend:

  1. Read the Excel into a DataTable (InputDt)
  2. Use the For Each Row Activity to loop over the rows
  3. Use an Assign Activity inside the loop to Assign a required value to given column(s). In your case you can assign row(“ColumnName”) = Now.ToString(“yyyy/MM/dd”).
  4. After the For Each Row Activity you can perform Write Range to write the updated InputDt to required Excel or the same Excel file

Hope this helps ! Kudos :slight_smile:

Regards,
Nithin

1 Like

Can you please help with the example…i did the same its not working.

Hi @vaish

You
can do in this way too

  1. Assign the current date to the variable let’s say date = DateTime.Now.ToString(“yyyy/MM/dd”)

  2. Use excel application scope , inside use read range to read the excel file and store in datatable DT

  3. get the no of rows of datatable as DT.Rows.Count and store in the variable let’s say
    count

  4. Create another integer variable a and assign it’s value as 2 (If u want the not to start write from A2, u can assign a as 2)

  5. Use while loop with condition as a<= count

inside it use write cell activitiy with value to be written as date variable and cell no should be specified as “A”+a.ToString

  1. After this assign a = a+1 inside the while loop so that it can write in next cell

Hope it helps you

Mark it as solution if u works

Nived N :robot:

Happy Automation :relaxed::relaxed:

Hi @vaish

May I know whether the excel file u are reading is empty or not

Thanks, i will try and update you

no its not empty.having values and performing vlookup and finally am doing this part…

1 Like

Hi @vaish

Ok then try my solution

May I know to how cell for u want to write the current date like starting from A2 to what cell?

Nived N :robot:
Happy Automation :relaxed:

yeah , its working fine for me … thanks for your help…

1 Like

Hi @vaish. What u got in end after trying @Nithin_P way?

I think in that way too u can get it

i tried… but it not throw any error and excepted output …
i think i implemented it in wrong way.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.