Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Error: External table is not in the expected format

Error: External table is not in the expected format

Scheduled Pinned Locked Moved C#
helptutorial
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NarVish
    wrote on last edited by
    #1

    Hi, I used the below connection string to read excel file. connectionString = "Provider=Microsoft.Jet.OLEDB.12.0;Data Source=D:\test2.xlsx;Extended Properties=\'Excel 12.0;HDR=No;\"; While opening, an exception is thrown.. "External table is not in the expected format" I explored in serveral sites and changed the connection string as mentioned there and followed other solutions. But none of them didn't work. Please guide me to solve this issue. Thanks in advance.

    L 1 Reply Last reply
    0
    • N NarVish

      Hi, I used the below connection string to read excel file. connectionString = "Provider=Microsoft.Jet.OLEDB.12.0;Data Source=D:\test2.xlsx;Extended Properties=\'Excel 12.0;HDR=No;\"; While opening, an exception is thrown.. "External table is not in the expected format" I explored in serveral sites and changed the connection string as mentioned there and followed other solutions. But none of them didn't work. Please guide me to solve this issue. Thanks in advance.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Your driver version is not correct; you need the ACE driver and Microsoft.Ace.OLEDB.12.0 for your connection string. See Working with MS Excel(xls / xlsx) Using MDAC and Oledb[^] for further details.

      Use the best guess

      N 1 Reply Last reply
      0
      • L Lost User

        Your driver version is not correct; you need the ACE driver and Microsoft.Ace.OLEDB.12.0 for your connection string. See Working with MS Excel(xls / xlsx) Using MDAC and Oledb[^] for further details.

        Use the best guess

        N Offline
        N Offline
        NarVish
        wrote on last edited by
        #3

        I used the below connection string as mentioned in the given article. Still error exists connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\test.xlsx;Extended Properties=\"Excel 12.0;HDR=NO\"";

        L 1 Reply Last reply
        0
        • N NarVish

          I used the below connection string as mentioned in the given article. Still error exists connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\test.xlsx;Extended Properties=\"Excel 12.0;HDR=NO\"";

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You need to escape the backslash in your file name thus:

          "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\test.xlsx;Extended Properties=\"Excel 12.0;HDR=NO\"";

          Use the best guess

          N 1 Reply Last reply
          0
          • L Lost User

            You need to escape the backslash in your file name thus:

            "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\test.xlsx;Extended Properties=\"Excel 12.0;HDR=NO\"";

            Use the best guess

            N Offline
            N Offline
            NarVish
            wrote on last edited by
            #5

            :) I'm reading that data source value in runtime. so blackslash is not an issue.

            L 1 Reply Last reply
            0
            • N NarVish

              :) I'm reading that data source value in runtime. so blackslash is not an issue.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              I can only assume that there is something else causing the problem. Are you able to read the file with Excel?

              Use the best guess

              N 1 Reply Last reply
              0
              • L Lost User

                I can only assume that there is something else causing the problem. Are you able to read the file with Excel?

                Use the best guess

                N Offline
                N Offline
                NarVish
                wrote on last edited by
                #7

                I followed below steps to make it work. Now, I'm able to read file 1. open your excel file 2. try to read that 3. Able to read the file 4. to read the file next time, no need to open the file. I don't know the reason how and why its working :)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups