Excel write range :current date and time

I want to write current date and time in excel after bot run succesfully pls give me formula or exp for that

@Kuldeep_Pandey
Datetime.Now.ToString would give you current date or
DateTime.Now.ToString(“yyyy/MM/dd HH:mm:ss”)

Hi,

If we need to write current datatime as DateTime type in the sheet, can you try to use just Now with WriteCellX activity etc?

Sample20221208-5.zip (8.9 KB)

Regards,

1 Like

IT Will increase row ? after completed one status it can write for anotherone also na?

Hi,

The above sample write date to specific cell (“B2”).
We can modify where to write it.

Regards,

image
Like i want to write status and current date time so i can i give in a loop to write

HI,

It depends on your loginc.
If you use ForEachExcelRow activity, we can write it as the following, for example.

Or as another approach, we can also update datatable which is read by ReadRange, then wirte whole datatable to the sheet using WriteRange.

Regards,

1 Like

You could read it as datatable and simply use for each row in data table.To loop through each row and assign the value of status and current date.

Current time is giving error

What is the error then?

So what activity we can use write range or write cell?

end of expression expected

@Kuldeep_Pandey
Write range workbook activity or write range if you use excel activity.

what range i should give? for status C2?

@Kuldeep_Pandey
Write the entire data table in an excel sheet don’t need to mention any range in write range activity


how to get resolve this error

@Kuldeep_Pandey
Remove .tostring and just give"completed"

Error

@Kuldeep_Pandey
Use read range workbook and get the excel data ads datatable .
Then use for each row in data table , assign the value to status and current date

You should pass data table variable inside the field not string

@Kuldeep_Pandey Use this method and Enable the auto-increment row checkbox in the write cell activity.