Excel >> How to read Excel file in asp/Asp.net/vb/vb.net

by SUUgNy4wIHN1cHBvcnRpbmcgdGhlIDNLQiBvZiBxdWVyeXN0cmluZw » Mon, 25 Aug 2008 11:28:01 GMT

I am writing a program in that i need to read the excel file.
Any can help me in this context


Excel >> RE: How to read Excel file in asp/Asp.net/vb/vb.net

by VmFsIE1henVyIChNVlAp » Thu, 16 Oct 2008 05:21:03 GMT


There are different ways to export data into Excel and you could find them here

http://support.microsoft.com/kb/306022/

1. Using Automation method gives you full control about what could be
generated, but it is much slower than Jet and consumes a lot of memory. In
addition Automation is COM-based. This method generates true XLS files

2. Using Jet OLEDB is pretty fast, but does not provide formatting
capabilities, and if you do not need any formating, it could be what you
need. It also generates true XLS files

3. You can also try .NET components I have created to work with Excel (you
can download them from my web site). They do not need Excel or Jet installed
and work on binary level and allow generating Excel files in native XLS, XLSX
or Excel XML formats.

--
Val Mazur
Microsoft MVP
http://xport.mvps.org






Similar Threads

1. Opening word, excel, pp document under asp.net with VB.net code behind - Asp.Net

2. VB.Net (in ASP.Net) won't create instance of Excel

I was able to get procedure to work in a VB.Net Windows application, and want 
to get it to work within a ASP.Net page.  It won't create the instance of 
Excel.  It blows up on the CreateObject class.

What am I missing?

Code, Error and Stack info are as follows:

Code:
        Dim xlApp As Microsoft.Office.Interop.Excel.Application
        xlApp = CreateObject("Excel.Application")  '**** Blows-up here *****

Error Exception Details: 
    System.Exception: Cannot create ActiveX component.

Stack Trace: 
   [Exception: Cannot create ActiveX component.]
   Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String 
ServerName)
   ReserveDB.WebForm1.btCreateDB_Click(Object sender, EventArgs e) in        
       c:\inetpub\wwwroot\ReserveDB\WebForm1.aspx.vb:40
   System.Web.UI.WebControls.Button.OnClick(EventArgs e)
      
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler 
sourceControl, String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   System.Web.UI.Page.ProcessRequestMain()

 
Thanks, Mark

3. RE : Accessing Excel through ASP.NET (VB.NET)

4. Accessing Excel through ASP.NET (VB.NET)

Hi All,

I am developing an application which requires opening an 
Excel Workbook through ASP.NET code, raise a few events 
to execute VBA code and then get results from Excel and 
display them on web-page. I am getting 'Access is Denied' 
error. I tried to give full permissions to ASPNET user to 
Excel.EXE, the directory in which .xls file is stored and 
even windows root, but the error still persists. It is 
not able to execute the line 'MyXL = New 
Excel.Application'.

I have spent a lot of time working on this problem. Any 
help is appreciated.

I tried the following code:
Imports Microsoft.Office.Interop

Public Sub writeExcel(ByRef s As String, ByRef locn As 
String)
        Dim MyXL As Excel.Application
        Dim MyWB As Excel.Workbook
        MyXL = New Excel.Application
        MyWB = MyXL.Workbooks.Open("C:/SomeBook.xls")
        MyWB.Worksheets("Sheet1").Range(locn).Value = s
        MyWB.Save()
        MyWB.Close()
        MyWB = Nothing
        MyXL.Quit()
        MyXL = Nothing
End Sub

ERROR:
Access is denied. 
Description: An unhandled exception occurred during the 
execution of the current web request. Please review the 
stack trace for more information about the error and 
where it originated in the code. 

Exception Details: System.UnauthorizedAccessException: 
Access is denied. 

ASP.NET is not authorized to access the requested 
resource. Consider granting access rights to the resource 
to the ASP.NET request identity. ASP.NET has a base 
process identity (typically {MACHINE}\ASPNET on IIS 5 or 
Network Service on IIS 6) that is used if the application 
is not impersonating. If the application is impersonating 
via <identity impersonate="true"/>, the identity will be 
the anonymous user (typically IUSR_MACHINENAME) or the 
authenticated request user. 

To grant ASP.NET write access to a file, right-click the 
file in Explorer, choose "Properties" and select the 
Security tab. Click "Add" to add the appropriate user or 
group. Highlight the ASP.NET account, and check the boxes 
for the desired access.

Thanks.

Regards,
Amol Goel

5. VB.Net (in ASP.Net) won't create instance of Excel - Microsoft .NET Framework

6. ASP.NET/VB.NET Muti-sheet excel downloads

I can produce an excel download of a dataset and save it 
to the clients machine. (VB.NET/ASP.NET)

I want to be able to download 3 datasets to the same excel 
workbook, either 3 sheets or all on the same sheet.

Can anyone help?

Baza

7. VB.Net (in ASP.Net) won't create instance of Excel - VB.Net

8. Populate Excell Sheet using ASP.NET/VB.NET

I have an Excel sheet that I want to be able to make changes to it
using ASP/VB.NET (like updating cells values and maybe formulas). Once
it's done; I want to save it and then launch the changed file to the
user. 

How do I do that? Any examples available?