Open .xlsx excel file Microsoft.ACE.OLEDB.12.0

Discussion in 'ASP.NET 2.0' started by ethanj, Jul 30, 2008.

  1. Hello,

    I am trying to open an Excel 2007 file and read the data into a gridview
    Here is my connection string:

    Dim strPhysicalPath As String = Server.MapPath('uploads/MyFile.xlsx')
    Dim objConnMain As New OleDbConnection('Provider=Microsoft.ACE.OLEDB.12.0;Data source=' & strPhysicalPath & ';Extended Properties=''Excel 12.0;HDR=Yes;IMEX=1''')
    objConnMain.Open()


    This will open a .xls file (excel 2003) but not a .xlsx file. I get an error that the file is not in the expected format. It of course it works on my local machine.
    Any ideas?

    Thanks.
     
  2. Some dll's did not have the correct permissions on the server. Lucas got it straightened out for me.

    Thanks
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    Try reuploading your excel file (make sure you use binary mode when uploading), the file may be corrupted during upload.
     
  4. Sorry, I do not know what he changed.
     
  5. Hi,
    Could you tell me what permissions did he change?
    I have the exact same problem. I need to know the solution. My app has a production deadline in a month.
    Any help is welcome.
    Thanks in advance.
    Kirthi
     
  6. Bruce

    Bruce DiscountASP.NET Staff

    i recommend opening a support ticket and refer to this post.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page