I have a column in excel file(type=custom), having a date as 30/04/24
when read, it reads as 5 digit value- 45321
i want to convert it into dd/MM/yyyy hh:mm:ss format
tried datetime.parseexact…system.globalization
but this throws error
Can anyone please help
If you want to change the format for first column, check the below LINQ Expression,
→ Use Read range workbook activity to read the excel and store in a datatable called Input_dt.
→ Use the assign activity and write the belo LINQ expression,
- Assign -> Output_dt = (From row In Input_dt
Let DateCol = DateTime.ParseExact(row("BOOK_DATE").toString, "M/d/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy hh:mm:ss")
Let newRow = Input_dt.Clone().Rows.Add(row.ItemArray.Select(Function(column) If(column.Equals(row("BOOK_DATE")), DateCol, column)).ToArray())
Select newRow
).CopyToDataTable()
→ Then use the Write range workbook activity to write the Output_dt in the excel.
Do one thing when you are reading the excel by using the Read range workbook activity, open the properites and check the preserve format then it will read in the same format… @shilpashree.mohanty