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. Reading from Excel (quick question)

Reading from Excel (quick question)

Scheduled Pinned Locked Moved C#
questionsysadmin
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.
  • B Offline
    B Offline
    BECK7
    wrote on last edited by
    #1

    Hi, i have a quick question. I have an application installed in a server that reads from Excel, is it necesary to have installed Excel so the application can read the excel files??

    T 1 Reply Last reply
    0
    • B BECK7

      Hi, i have a quick question. I have an application installed in a server that reads from Excel, is it necesary to have installed Excel so the application can read the excel files??

      T Offline
      T Offline
      turbochimp
      wrote on last edited by
      #2

      It depends on what you mean by "Excel files", and how they are being read. If you mean comma separated value files (*.CSV) that a user might open in Excel, then no, you don't need Excel to read them. If you mean files saved in the Excel format (*.xls), then the answer is "maybe", and you would need to give more information about the server-side component that reads the files. If it uses some form of MS Office automation (which would interop with the Excel runtime callable COM wrappers), then you would need at least some parts of Excel installed on the server. However, if the server component is using the Jet database engine or some other proprietary driver(s) for accessing Excel, the requirement for installing Excel in and of itself is removed, however a new requirement may arise to support the component(s) reading the spreadsheets (Jet used to require some add-on components to intrepret Excel - don't know if they're a requirement any more, or if they are just installed automatically with Jet). Hope this helps.

      The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

      B 1 Reply Last reply
      0
      • T turbochimp

        It depends on what you mean by "Excel files", and how they are being read. If you mean comma separated value files (*.CSV) that a user might open in Excel, then no, you don't need Excel to read them. If you mean files saved in the Excel format (*.xls), then the answer is "maybe", and you would need to give more information about the server-side component that reads the files. If it uses some form of MS Office automation (which would interop with the Excel runtime callable COM wrappers), then you would need at least some parts of Excel installed on the server. However, if the server component is using the Jet database engine or some other proprietary driver(s) for accessing Excel, the requirement for installing Excel in and of itself is removed, however a new requirement may arise to support the component(s) reading the spreadsheets (Jet used to require some add-on components to intrepret Excel - don't know if they're a requirement any more, or if they are just installed automatically with Jet). Hope this helps.

        The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

        B Offline
        B Offline
        BECK7
        wrote on last edited by
        #3

        I am using the jet database engine. I installed an excel viewer but still give me the error. The problem is that the error says: "No error information available: E_FAIL(0x80004005)"...What else could i try?

        T 1 Reply Last reply
        0
        • B BECK7

          I am using the jet database engine. I installed an excel viewer but still give me the error. The problem is that the error says: "No error information available: E_FAIL(0x80004005)"...What else could i try?

          T Offline
          T Offline
          turbochimp
          wrote on last edited by
          #4

          You did not previously indicate that you were having a problem or receiving any exception information, so it was a little difficult to give you specific advice. I don't know what you mean by "Excel Viewer", but if you mean one of the GUI applications that allows viewing Office documents without having all of Office installed, it's unlikely to make a difference. You need (to share) more information about the server-side component that's trying to read the Excel spreadsheets. As I mentioned before, your results are highly dependent upon what that component is doing. There is no way to give you any considered advice without knowing what the "reader" component is doing and how. I can give you suggestions based upon the error number you're receiving, but they are not likely to yield much in the way of actual help - you can look up the error number (0x80004005) at: http://support.microsoft.com[^] There are numerous hits there, because the error number covers quite a bit of error-related real estate. The first item pertains to the Jet engine, and the fact that if connection properties are not correctly set (using, say, an OleDbConnection with Jet), then the specified error code might return, indicating a failure to find an ISAM. Somewhere to start, anyway.

          The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

          B 1 Reply Last reply
          0
          • T turbochimp

            You did not previously indicate that you were having a problem or receiving any exception information, so it was a little difficult to give you specific advice. I don't know what you mean by "Excel Viewer", but if you mean one of the GUI applications that allows viewing Office documents without having all of Office installed, it's unlikely to make a difference. You need (to share) more information about the server-side component that's trying to read the Excel spreadsheets. As I mentioned before, your results are highly dependent upon what that component is doing. There is no way to give you any considered advice without knowing what the "reader" component is doing and how. I can give you suggestions based upon the error number you're receiving, but they are not likely to yield much in the way of actual help - you can look up the error number (0x80004005) at: http://support.microsoft.com[^] There are numerous hits there, because the error number covers quite a bit of error-related real estate. The first item pertains to the Jet engine, and the fact that if connection properties are not correctly set (using, say, an OleDbConnection with Jet), then the specified error code might return, indicating a failure to find an ISAM. Somewhere to start, anyway.

            The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

            B Offline
            B Offline
            BECK7
            wrote on last edited by
            #5

            This my string conexion: strConection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" l.xls@";Extended Properties=Excel 8.0;"; then i build the object: OleDbConnection oConection = new OleDbConnection(strConection); and open the conection: oConexion.Open();--->HERE IS WHERE I GET THE RROR In my server i have installed: Microsoft Office Excel Viewer 2003 In my Data Sources(ODBC) i have no USER DSN, SYSTEM DSN In my drivers I have Driver do Microsoft Excel (4.00.6200) and Microsoft Excel Driver (4.00.6200) What other information i can give u? Thanks for all the help

            T 1 Reply Last reply
            0
            • B BECK7

              This my string conexion: strConection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" l.xls@";Extended Properties=Excel 8.0;"; then i build the object: OleDbConnection oConection = new OleDbConnection(strConection); and open the conection: oConexion.Open();--->HERE IS WHERE I GET THE RROR In my server i have installed: Microsoft Office Excel Viewer 2003 In my Data Sources(ODBC) i have no USER DSN, SYSTEM DSN In my drivers I have Driver do Microsoft Excel (4.00.6200) and Microsoft Excel Driver (4.00.6200) What other information i can give u? Thanks for all the help

              T Offline
              T Offline
              turbochimp
              wrote on last edited by
              #6

              Okay. First, put double-quotes around your Extended Properties value array. This requirement is not documented, but the lack of quotations around the Extended Properties will mess up the parsing of the connection string (nice, huh? Love those semicolons - the universal separator :)) resulting in the exception you're seeing. See below for an example connection string that's confirmed working... Now, if that doesn't do it: I don't have a PC without Excel on it at the moment, but I did make a little sample application to read data from Excel spreadsheets. I used the connection string:

              string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"c:\\mydocument.xls\";Extended Properties=\"Excel 8.0;HDR=Yes;\"";
              

              in my application. One difference is the addition of the HDR extended property. You could also alternately choose to use IMEX as an extended property, but I don't think they'd make a lot of difference, but might be worth a try: "HDR=Yes;" indicates that the first row contains columnnames, not data "IMEX=1;" tells the driver to always read "intermixed" data columns as text
              Failing all other solutions to your exception problem, I would have to guess that your server has a damaged or missing Indexed Sequential Access Method (ISAM) driver for Excel. There's an article here[^] that discusses how the Jet Db engine is used to access Excel workbooks. Here[^] is a link dealing with how to repair missing/corrupted ISAM files. I hope this helps - after this I've got nothing...

              The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

              B 1 Reply Last reply
              0
              • T turbochimp

                Okay. First, put double-quotes around your Extended Properties value array. This requirement is not documented, but the lack of quotations around the Extended Properties will mess up the parsing of the connection string (nice, huh? Love those semicolons - the universal separator :)) resulting in the exception you're seeing. See below for an example connection string that's confirmed working... Now, if that doesn't do it: I don't have a PC without Excel on it at the moment, but I did make a little sample application to read data from Excel spreadsheets. I used the connection string:

                string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"c:\\mydocument.xls\";Extended Properties=\"Excel 8.0;HDR=Yes;\"";
                

                in my application. One difference is the addition of the HDR extended property. You could also alternately choose to use IMEX as an extended property, but I don't think they'd make a lot of difference, but might be worth a try: "HDR=Yes;" indicates that the first row contains columnnames, not data "IMEX=1;" tells the driver to always read "intermixed" data columns as text
                Failing all other solutions to your exception problem, I would have to guess that your server has a damaged or missing Indexed Sequential Access Method (ISAM) driver for Excel. There's an article here[^] that discusses how the Jet Db engine is used to access Excel workbooks. Here[^] is a link dealing with how to repair missing/corrupted ISAM files. I hope this helps - after this I've got nothing...

                The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

                B Offline
                B Offline
                BECK7
                wrote on last edited by
                #7

                Ok, ill try with this. Thanks for all ur time. Ill let u know what happened

                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