Not a legal Ole Aut date

Aug 25, 2014 at 10:23 PM
When I try to execute the following lines:
DataSet ds = new DataSet();
ds = execlReader.AsDataSet();

I get the following exception:
Not a legal Ole Aut date

Any ideas?
Aug 26, 2014 at 8:47 PM
Some additional info, I have identified the rows that are throwing the exception. The cell type is date. The field displays ########### and when I click on the cell I see negative 3650000 in the value window, obviously a bad date. Excel handles the bad data by replacing the value with # signs but the reader exceptions out on the conversion to DataSet. Is there any way to force the reader to fill the rest of the DataSet and ignore or return an error value for the bad fields?

Along those lines, I'm trying to figure out how to get the ExcelDataReader source from GitHub and trace through to see where the exception is thrown but I'm a GetHub noob. Can anyone give me a step-by-step?

Thanks for all the work that goes into supporting something like this.
Aug 26, 2014 at 10:17 PM
Ok, I managed to get the source downloaded and fixed the problem in the following routine by range checking the DateTime.FromOADate values from the MS documentation, following the line "added to fix out of range problem, sdh, 20140826":
    public static object ConvertFromOATime(double value)
    {
        if ((value >= 0.0) && (value < 60.0))
        {
            value++;
        }
        //if (date1904)
        //{
        //    Value += 1462.0;
        //}

      // added to fix out of range problem, sdh, 20140826
      if (value < 657435.0)
      {
        value = 657435.0;
      }
      else if (value > 2958465.99999999)
      {
        value = 2958465.99999999;
      }
        return DateTime.FromOADate(value);
    }

Let me know how you would like to handle this.
Developer
Aug 27, 2014 at 8:17 AM
Thanks for this.

Fyi - In github, create a github account. Then fork the project. It will then give you a clone url, or if on windows you can use the "clone in desktop link".
Make your changes, then commit them locally and push them back to github (that will be to your fork - you won't be able to push to the exceldatareader repo).

Then go to Pull Request on your fork and click new pull request. That will send a pull request to the exceldatareader repo, which I can review and then merge in.
Sep 2, 2014 at 3:13 PM
Hmm, you lost me at "and push them back to github". I have committed my changes to my local copy but after that I'm at a loss as to how to check this into the github repository. I'm running git from Visual Studio 2012 if that helps at all. Maybe I checked the source out incorrectly?

Thanks.
Sep 2, 2014 at 9:53 PM
Ok, I think I got the github stuff worked through. I think I submitted a pull request but, if not, let me know and I will try again.