Excelq

Hi all,
I have an excel file with data in it, i am doing some filteration and written it to another excel, in that excel my time format is getting changed to decimals, so i have changed into proper time format using for each loop now i want to write this time into existing excel.

My excel has data like message, send, receive, date, time, sender, receiver - so i want to change the time from decimals to normal time and write it back to the same excel

How should I do it. Can anyone help me.

@hanviprebday

Please use format cells and change the excel cell format to required

image

cheers

I want to format time and write it to existing excel

@hanviprebday

The time format depends on the excel cell format and might not change with changing the format in datatable…

So it is better to go with this

Or in the datetimeformat at the start include single quote (') and then write the data back to excel…then you will get in exact same format as you change

Eg : dattevar.ToString("'MM/dd/yyyy")

Cheers

Hi @hanviprebday

Within the loop, you can access the time column of each row using the row index and column name. Assuming the time column is named “Time”, you can use the following code to convert the decimal time to a proper time format:

row(“Time”) = TimeSpan.FromDays(CDbl(row(“Time”))).ToString(“hh:mm:ss”)

After converting the time format for all rows, use the “Write Range” activity to write the updated DataTable back to the same Excel file. This will overwrite the existing data with the modified values.

Thanks!!