DataTable string? Object type?

When using ReadRange to compare numerically with acquired data on a DataTable, you may get a “not a string” error.

Does ReadRange store 100% cell data as strings? Object type?

1 Like

@YYSS

Sorry I didn’t get you. Could you please tell more details about the issue for better understanding.

Yes of course
—Usually when we are trying to read the excel with excel activities like read range or even with workbook activity the output of the READ RANGE will be a DATATABLE where all the columns will be of STRING type
—even if the excel column has DateTime or numerical type of column while reading excel columns with read range, the datatable corresponding columns will be of type STRING
— we can check that either with a simple DateTime value
Put some date in excel like 12-04-2019
Now while reading with read range activity and use a writeline and check we will be getting the string converted format like
12/04/2019 00:00:00

— same applies to numerical value as well it will get converted to string format
May be if we want to change the type later
Yourdatatablename.Columns(“yourcolumnname”).Datatype = GetType(System.Int32)

Simple isn’t it
Hope this would help you
Kindly try this and let know for any queries or clarification
Cheers @YYSS

1 Like

using read range , data stored as a string in datatable

Hi, I am getting error while using below statement -
Yourdatatablename.Columns(“yourcolumnname”).Datatype = GetType(System.String)

Could you please help me on this