String Not Recognized as a Valid Date Time

in addition to @supermanPunch lets have a closer look on OADates, DateStrings in 1 or more formats.

  • An EAS read range vs. WorkBook read range can result to different column values for the date columns within the data table
  • depending on some other factors e.g Excel cell formatting (when a new/another file is processed), Local settings of the system etc. … the value of the date column can flicker between OADates double, strings with different formats

As we can see in my analysis job it was not listing any OADates. Arpan encountered OADates Doubles.

With the motivation to setup a stable running Bot we would recommend that you will check the expected data variations and maybe setup a cascade base on TryParseXX logic.

grafik
And
DateTime.TryParseExact(…

So it can be incorporated to - IF

  • value is double → process as OADate
  • value is String → check if it parseable with configured formats
  • value is different → route it to an alternate branch

From development perspective we would not recommend to derive routing decissions from Exception occurences as long the exception is not in detail checked for the particular root cause.

With the given tools and techniques we do feel that you are well equipped for the implementation task. For further help we are here for sure

1 Like