3
Answers

c# xls and xlsx file import

Hi,

I want to load xls and xlsx file in c#. 
For xls I'm using:  Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<filename>;Extended Properties=\"Excel 8.0;HDR=YES\ 
For xlsx :  Provider=Microsoft.Ace.OLEDB.12.0;Data Source=<filename>;Extended Properties=\"Excel 12.0;HDR=YES\ 
once the projects platform target was Any Cpu
I can upload xlsx file without problem but when I upload xls file I got the following error:
"The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine."

And if I change the Platform Target to x86 then xls file is uploaded without problem but 
this time xlsx file is giving this error:
"The 'Microsoft.Ace.OLEDB.12.0' provider is not registered on the local machine."

How can I upload but file formats without error?

Thanks
Answers (3)