Excel into Datatable with string datatype columns


#1

When reading excel into a datatable, it is assigning datatype of columns as object. Is there any option to read everything as datatype string.


#2

Not with current implementation.

To dive a little deeper though, the DataTable columns are of type Object, but the underlying values have actual types based on how Excel sees them - so it actually reads numbers as Double, dates as DateTime and other things as String.
But, since everything is an Object and Excel does not enforce columns to be of certain type, having DataColumns be defined as Object is the most straightforward way to read a range without crashing when a different type is encountered.


#3

Hi andrzej,

i have a similar issue please can you help me. i have a column in excel name as Date_ transaction i tried to find the datataype of that column and it was object now the thing is somehow i want to convert that datatype to string of the entire column but i am not able to do it somehow.
Any idea how can i convert the entire date_transaction column to string type