Thanks for the reply, Is there any alternate to proceed without installing excel.
My excel file contains Folder names and the content to be saved as text documents in those folders. So using Jet engine drivers doesnt cater my requirement, as there are no tables to save excel data and need to save only flat files.
You can still use the Jet driver to read the folder names and content from the excel file. Store that data into a DataTable object and then loop through its rows to create files.
Or you can use third party control like
ASPOSE to read excel files which does not required installing Excel on server.
Or if you are using Excel 2007 and above you can use the OpenXml standard to read data as shown below:
Kushi Bobby
Member
20 Points
29 Posts
Reading excel file from C#
Apr 10, 2012 11:30 AM|LINK
Hi,
I have developed a web Application (Asp.net/C#) where am reading excel file in shared drive and creating folders on the Users Desktop.
its working fine in Dev and Local systems. As server isnt installed with excel, am using Interop.excel dll, but still am getting the below exception:
"etrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154."
Can somebody pls advice, does it need to be mandatory to have Excel installed, or the above is some permission related issue.
jigarbjpatel
Member
454 Points
88 Posts
Re: Reading excel file from C#
Apr 10, 2012 11:41 AM|LINK
Yes, Excel is required to be installed.
swapna.anu
Contributor
2658 Points
746 Posts
Re: Reading excel file from C#
Apr 10, 2012 12:51 PM|LINK
Hi
Read the below blog
http://www.vbforums.com/showthread.php?t=582423
I understand that its not possible without excel installation but I remember trying the same scenario with the installation of below.
This is the link for the download which supports to work with the Microsoft Excel documents in VS projects. http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=23734
Hope this helps.
bhaskar.mule
Contributor
2280 Points
659 Posts
Re: Reading excel file from C#
Apr 10, 2012 12:55 PM|LINK
hi
i hope it will help you
http://www.aspdotnet-sharepoint.com/2012/04/how-to-read-data-from-excel-file-in.html
Site:Rare technical solutions
Kushi Bobby
Member
20 Points
29 Posts
Re: Reading excel file from C#
Apr 11, 2012 01:50 AM|LINK
Hi Patel, Swapna and Baskar,
Thanks for the reply, Is there any alternate to proceed without installing excel.
My excel file contains Folder names and the content to be saved as text documents in those folders. So using Jet engine drivers doesnt cater my requirement, as there are no tables to save excel data and need to save only flat files.
Thanks
jigarbjpatel
Member
454 Points
88 Posts
Re: Reading excel file from C#
Apr 11, 2012 05:16 AM|LINK
You can still use the Jet driver to read the folder names and content from the excel file. Store that data into a DataTable object and then loop through its rows to create files.
Or you can use third party control like ASPOSE to read excel files which does not required installing Excel on server.
Or if you are using Excel 2007 and above you can use the OpenXml standard to read data as shown below:
http://www.codeproject.com/Articles/15593/Read-and-write-Open-XML-files-MS-Office-2007
http://msdn.microsoft.com/en-us/library/bb332058(v=office.12).aspx
Kushi Bobby
Member
20 Points
29 Posts
Re: Reading excel file from C#
Apr 11, 2012 10:41 AM|LINK
Hi Patel,
Thanks
U mean, even without excel installation,by Using Jet drivers, can we achieve it?
can u pls provide an example.
jigarbjpatel
Member
454 Points
88 Posts
Re: Reading excel file from C#
Apr 11, 2012 11:32 AM|LINK
Yes, even without Excel you can use jet drivers. Of course the Jet driver needs to be there on server.
Here are the links for using Jet driver
http://codehill.com/2009/01/reading-excel-2003-and-2007-files-using-oledb/
http://www.tipsntracks.com/100/read-and-display-data-from-an-excel-file-xsl-or-xlsx-in-aspnet.html
http://vb.net-informations.com/excel-2007/vb.net_excel_oledb.htm
Kushi Bobby
Member
20 Points
29 Posts
Re: Reading excel file from C#
Apr 12, 2012 01:33 AM|LINK
Hi Patel,
Thank u very much for the reference. it may sounds strange, but am not sure about the location and how to copy the drivers in the server.
Can u pls advice, how to get them.
jigarbjpatel
Member
454 Points
88 Posts
Re: Reading excel file from C#
Apr 12, 2012 03:38 AM|LINK
Jet driver 4.0 (Microsoft.Jet.OLEDB.4.0) should be present on the server. It should be there by default unless removed.