Importing excel data to MS SQL using EPPlus

Benjamin Chew 42 Reputation points
2023-02-03T02:31:52.5066667+00:00

I am writing a C# code in .Net 6 to read data from excel and save them into the database.

when reading the column with date/ date time value I realized that if the cell contains a time portion, Epplus will return the cell value as 9/1/2000 8:00:00 AM, but if the cell value only contains date, Epplus will return the value as an integer, eg: 39580.

would like to know if it is possible to standardize the return of both cell values to return in integer/double?

Microsoft 365 and Office Excel For business Windows
SQL Server Other
Developer technologies C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Olaf Helper 47,436 Reputation points
    2023-02-03T06:20:47.2766667+00:00

    First, EPPlus isn't a Microsoft product, contact the author for support: https://github.com/JanKallman/EPPlus

    Second, Excel stores a (nuermic) value and a format information; for Excel 39580 is it a valid value for date 2008-05-12.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.