Link to home
Start Free TrialLog in
Avatar of Kranarna
Kranarna

asked on

Read an excel file 2003 and later without having Excel installed

How can i read a excel file 2003 or later without having excel installed on my computer.

I have first used Microsoft.Office.Interop.Excel.dll and it work fine on my computer. Then when i moved the webapp to the server I got the message:

Excel ERROR: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154.

I google for this and found the answer that to use Microsoft.Office.Interop.Excel.dll  you must have Excel installed on your computer. That is not an option for me so is there any other way to do this?
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

You can use OleDb to read an Excel file as a table, without having Excel installed.

Bob
Avatar of Kranarna
Kranarna

ASKER

For excel 2003 and later? Because before I used this
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +  pPath & filnamn + ";" + "Extended Properties=""Excel 8.0;HDR=NO;"
But with the new excel format it doesnt work anymore. Is the a new version of OLEDB ?
What do you mean it doesn't work anymore?

Bob
I get this errormessage

Microsoft JET Database Engine error '80004005'
External table is not in the expected format.

And that is because the excelfile is in a "new" format. That is at least what I have figured out by serching for this error.
Are you talking about Excel 2007?

Bob
ASKER CERTIFIED SOLUTION
Avatar of vbturbo
vbturbo
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, I got beaten to the punch (gotta love it!!)

Bob
vbturbo>I tried something similar to that before but maybe got something wrong because it didnt work then but I will try it on monday when I get back to work. So I will come back then.

TheLearnedOne> :)
Sorry for my late answer. I found another way to do this, but http://www.connectionstrings.com/?carrier=excel2007 that will surely work also. Thank you