We want to use GemBox.Spreadsheet for importing Excel data into a SQL database.
In order to avoid data type conflicts (as Excel allows “mixed” types due to its non-database nature), we first try to determine if all cells in a column have the same value type (e.g. String or Double).
Unfortunately, it seems that the ValueType property does not always match the cell data type definition given in the Excel spreadsheet.
We took a rather simple table (please download from this link as I can only attach pictures to here) for our tests and calling
worksheet.Cells[7, 1].ValueType
resulted in the type String being returned although this cell (B8 in Excel) is formatted as Number (which should return Double in that case as decimal places are permitted) in the spreadsheet.
Maybe we are simply doing something wrong or making incorrect “assumptions” concerning the return value of ValueType. That’s why I just ask here in the forum instead of opening a support ticket - I assume that it’s just a misunderstanding and not a bug in GemBox.Spreadsheet.
Could somebody please shed some light on this case and give us a hint how we can achieve a simple “data type check” on all data in a certain column?