How to read .xls file without OLEDB connection RRS feed

  • Question

  • User-1285886855 posted

    Hello All,

    My ASP.Net application has to read an Excel file(.xls).One best way to get it done is by using OLEDB connection.

    But in my case, the application is hosted on a shared environment which allows only "Medium" trust application to run.But  "Medium"  trust does not allow OLEDB connections.So is there a way i can read the Excel file without using OLEDB connections.

    Thanks in advance,


    Thursday, January 24, 2008 4:27 AM

All replies

  • User537870505 posted

    You may consider 3rd party tools such as Aspose.Cells, ComponentOne XLS for .NET

    Thursday, January 24, 2008 5:16 AM
  • User-1285886855 posted

    Hi Siv,

    Thnkx for the prompt  reply.

    But these third party tools would be using OLEDB connection internally. So  it would not work in "Medium"  trust environment.

    Is there a class like system.io.packaging in asp.net 2.0 to read open XML formats? 

    Thursday, January 24, 2008 6:18 AM
  • User537870505 posted

    You can use System.IO.Packaging (after installing .NET 3.0) in ASP.NET 2.0, if that fulfills your needs.

    Thursday, January 24, 2008 6:28 AM
  • User1578686280 posted

    I tried Excel Reader .NET from devtriogroup.com. I used it in application on godaddy server with Medium Trust level.

    It easy in use with plain API functions. 

    Monday, October 25, 2010 7:50 AM
  • User32394187 posted
        Dim xlApp As Excel.Application
        Dim xlWorkBook As Excel.Workbook
        Dim xlWorkSheet As Excel.Worksheet
        xlApp = New Excel.Application
        xlWorkBook = xlApp.Workbooks.Open(".../xxx/xxx.xlsx.")
        xlWorkSheet = xlWorkBook.Worksheets("Sheet1")
     'to insert
        xlWorkSheet.Cells(2, 2) = "sdsdsdsdsdsd"
    'to read
    xlWorkSheet.Cells(2, 2).value 
        Private Sub releaseObject(ByVal obj As Object)
                obj = Nothing
            Catch ex As Exception
                obj = Nothing
            End Try
        End Sub
    'make sure to add excel reference to your project


    Monday, November 1, 2010 3:34 AM