New user help and Excel read question (Interop and OleDb)

Joined
Jun 2, 2005
Messages
7
Reaction score
0
Forgive me I'm a new user. I can't find how to search the newsgroups, only the forums.

I'm trying Excel Interop to read Excel spreadsheets using C#.
I'm "simply" loading the entire contents of the spreadsheet into RAM for manipulation.
All cell contents are loaded as strings, into a string[][].
I realize I'm not making full use of this Interop like most of you are, but the choices seem limited for C#->Excel interaction.
Cycling through cell by cell is painfully slow!
What are my other options?

I also tried using OleDb which is incredibly fast, but it also seems to "assume" data types and reads in long number strings as scientific-format numbers!
Is there a way around this data-type assuming by OleDb?
OleDb really seems like the ideal application for reading my Excel sheets, and the fastest.

Thanks everyone!

Mark
 
Well I'm able to convert the assumed data types on the fly after the data set is filled and I'm pulling out values.
The problem now is that I'm getting empty values in fields where it has assumed a data type and the field doesn't match correctly.

Is there a way to make the OleDb just blindly dump string values into a data set with NO datatype guessing???

If I have 2 different data types in my Excel column it will simply ignore one!
Example:
4.011E+16
40110010100010013

and I want to pull both in as strings, not numbers.

It actually pulls in a blank value for the first one!
Granted this is certainly not all the Excel file but I hope it's clear enough.
 
Last edited:
Fixed it!
Used Extended Properties=Excel 8.0; HDR=No;MAXROWS=100;IMEX=1;
The IMEX=1 is what fixed it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top