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. From Excel to C#

From Excel to C#

Scheduled Pinned Locked Moved C#
questioncsharphelp
7 Posts 5 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
    NaturePhoenix
    wrote on last edited by
    #1

    Let's say I have five sheets in excel workbook,and each sheet contains one table.Is there any way to Import only active sheet to my C#,What should I do to recognize only active sheet.??any help,ideas?? One more thing,How can I get a data to C# from Excel VBA control(let's say textbox). So I have vba control textbox in sheet and, I want to get textBox.value in my c# project??

    L R P 3 Replies Last reply
    0
    • N NaturePhoenix

      Let's say I have five sheets in excel workbook,and each sheet contains one table.Is there any way to Import only active sheet to my C#,What should I do to recognize only active sheet.??any help,ideas?? One more thing,How can I get a data to C# from Excel VBA control(let's say textbox). So I have vba control textbox in sheet and, I want to get textBox.value in my c# project??

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

      Don't give your self a headache as I did , Buy this "Aspose.Cells" , and get rid of Excel problems

      I know nothing , I know nothing ...

      1 Reply Last reply
      0
      • N NaturePhoenix

        Let's say I have five sheets in excel workbook,and each sheet contains one table.Is there any way to Import only active sheet to my C#,What should I do to recognize only active sheet.??any help,ideas?? One more thing,How can I get a data to C# from Excel VBA control(let's say textbox). So I have vba control textbox in sheet and, I want to get textBox.value in my c# project??

        R Offline
        R Offline
        Ravi Sant
        wrote on last edited by
        #3

        About first question you asked, you can include MS office excel object libraryand write:

        Excel.Worksheet workSheet = (Excel.Worksheet)workBook.ActiveSheet;

        Not sure about second requirement.

        N 1 Reply Last reply
        0
        • N NaturePhoenix

          Let's say I have five sheets in excel workbook,and each sheet contains one table.Is there any way to Import only active sheet to my C#,What should I do to recognize only active sheet.??any help,ideas?? One more thing,How can I get a data to C# from Excel VBA control(let's say textbox). So I have vba control textbox in sheet and, I want to get textBox.value in my c# project??

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          I dunno, I use ADO.net and the OleDb connector to read and write Excel and I don't think it will do everything you want.

          N 1 Reply Last reply
          0
          • P PIEBALDconsult

            I dunno, I use ADO.net and the OleDb connector to read and write Excel and I don't think it will do everything you want.

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

            Yes I do too,using ADO.net and the OleDb connector to read and write,so this is not possible with ado.net

            1 Reply Last reply
            0
            • R Ravi Sant

              About first question you asked, you can include MS office excel object libraryand write:

              Excel.Worksheet workSheet = (Excel.Worksheet)workBook.ActiveSheet;

              Not sure about second requirement.

              N Offline
              N Offline
              NaturePhoenix
              wrote on last edited by
              #6

              I did what u said,but nutin.Every time I get Sheet1 open.

              M 1 Reply Last reply
              0
              • N NaturePhoenix

                I did what u said,but nutin.Every time I get Sheet1 open.

                M Offline
                M Offline
                Mycroft Holmes
                wrote on last edited by
                #7

                IIRC there are about 5 different ways of opening a sheet/book/etc. You need to find some samples and work out which method you need. This generally takes a load of reaserch into articles and samples etc.

                Never underestimate the power of human stupidity RAH

                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