Statistics

Total Posts: 34
This Year: 0
This Month: 0
This Week: 0
Comments: 174


RSS 2.0   SocialTwist Tell-a-Friend


Admin

Sign In

Navigation


Recent Posts


On this page....

How do I read excel file data columns as TEXT always?

Archives

 Full Archives By Category
 2007 Calendar View
<May 2009>
SunMonTueWedThuFriSat
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

Categories

CDOSYS (1) Classic ASP (10) Command Line (2) Databases (16) Excel (1) HTML (1) IIS (10) Indexing Service (1) Internet Explorer (7) Media Streaming (1) MS.Net (2) SQA (7) SQL Server (16) Windows OS (2)

Blogroll - Fav Blogs


Acknowledgments

DasBlog Theme Design by: Tom Watts
E-mail: Send mail to the author(s)
Theme Image by: dreamLogic

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Technology Blog

Many developers/programmers while writing code to extract data from an excel Intermixed data columns struggle to read the data. Reading data from an excel file is always been a challenge as the first row (record) of the data in excel defines the data type of the column. For example if the first row has the data as Integer and any consecutive row has the data as Float, excel read operation would fail as it expects the rest of the data in that column to be of Integer type. When a column has data of different data type is called as Intermixed Data Columns.

Now the question is that how to read excel data from a column having Intermixed Data Types; the answer is that we read all the data as TEXT type.  You can build connection for an excel file using the below code:

Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\MyExcel.xls; Extended Properties="Excel 8.0;HDR=Yes; IMEX=1";

The Extended Property IMEX set to 1 tells the driver to always read Intermixed Data Columns as TEXT. Also note that HDR set to YES means that the first row in the excel file is the column header.

Classic ASP | SQA | Excel | MS.Net