Set your string to Date.ParseExact(MyStringDate, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture), where MyStringDate is the date you’ve pulled from Excel.
Make sure the string that failed is formatted as you’ve specified. It must have exactly the same format.
Also, that post should have been DateTime.ParseExact(MyStringDate, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture) based on the documentation below.