Read Cell: TypeConverter cannot convert from System.DataTime

Hi all, i am encountering an issue with my robot.

The variable type is set as generic value.

Hi @marct

Look like your column is formated as datetime values, in this case you can change the GenericValue type for DateTime value
image

Regards!

Hi @fernando_zuluaga

Another error appears if DateTime is used.

Previously i am able to run this robot, this error only happened after upgrading of UiPath to new pc.

Hi @marct ,

Ensure that the cell you are reading contains a valid date value. If the cell contains text or an invalid date format, it may cause the conversion error.

Instead of using the Read Cell activity, consider using the Read Range activity to read the entire Excel range containing the date column. This activity will read the data into a DataTable variable.

Once you have the data in a DataTable variable, you can use the For Each Row activity to loop through each row. Within the loop, you can access the date value using the column name or index.

To handle the conversion of the date value to a DateTime type, you can use the DateTime.Parse or DateTime.ParseExact methods. For example, if your date is stored as a string in the DataTable, you can convert it using the following code:
DateTime.Parse(row(“ColumnName”).ToString())
Replace “ColumnName” with the actual name of the column in the DataTable.

If the date format in the Excel cell is different from the standard format, you can use DateTime.ParseExact instead of DateTime.Parse to specify a custom date format string.

That error is not related to this topic, looks like now you have to debug your process and start updating the activities and values

Regards

@marct

Once you change the datatype of the variable from
Generic value to datatime…

Your function split is not working as datetime cannot be split

Use str_currentdate.ToString("MM/dd/yyyy") to get the required date directly…you need not use split when it is datetime to convert to a string time in required format

Hope this helps

Cheers