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. Managed C++/CLI
  4. Read Excel sheet

Read Excel sheet

Scheduled Pinned Locked Moved Managed C++/CLI
c++helpquestion
6 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.
  • M Offline
    M Offline
    mikobi
    wrote on last edited by
    #1

    Good morning, I am using Visual C++ 2005 and I import excel file in my program. If data are characters and numbers no problem, but when it is a date I have difficult. The system read date as a number. How can I do so I can read a date like a string or like a date exactly ? Can you help me ?

    T M 2 Replies Last reply
    0
    • M mikobi

      Good morning, I am using Visual C++ 2005 and I import excel file in my program. If data are characters and numbers no problem, but when it is a date I have difficult. The system read date as a number. How can I do so I can read a date like a string or like a date exactly ? Can you help me ?

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

      Excel stored a date using a double internally. You can use Format(The_Date "mm/dd/yyyy") is you want to pass a string with that format. Otherwise, just use a conversion function...

      M 1 Reply Last reply
      0
      • T T2102

        Excel stored a date using a double internally. You can use Format(The_Date "mm/dd/yyyy") is you want to pass a string with that format. Otherwise, just use a conversion function...

        M Offline
        M Offline
        mikobi
        wrote on last edited by
        #3

        I read Excel sheet range, I can not use this Format you say because I access the range values using GetValue(i,j). The way to do is to know how it convert this date to number so that I can write a function. Who can help me to know the algorithm use by Excel to convert date to double. Thanks

        T 1 Reply Last reply
        0
        • M mikobi

          I read Excel sheet range, I can not use this Format you say because I access the range values using GetValue(i,j). The way to do is to know how it convert this date to number so that I can write a function. Who can help me to know the algorithm use by Excel to convert date to double. Thanks

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

          Again, use the System Convert functions. You do not need to know Excel's representation, but it is fairly easy to figure out with google or changing the format of dates in excel and looking at the numbers.

          M 1 Reply Last reply
          0
          • T T2102

            Again, use the System Convert functions. You do not need to know Excel's representation, but it is fairly easy to figure out with google or changing the format of dates in excel and looking at the numbers.

            M Offline
            M Offline
            mikobi
            wrote on last edited by
            #5

            I my side I do not know what functions to use TO CHANGE DATE TO characters, the cell format do not change something in Excel. Can you show me how to do it please

            1 Reply Last reply
            0
            • M mikobi

              Good morning, I am using Visual C++ 2005 and I import excel file in my program. If data are characters and numbers no problem, but when it is a date I have difficult. The system read date as a number. How can I do so I can read a date like a string or like a date exactly ? Can you help me ?

              M Offline
              M Offline
              mikobi
              wrote on last edited by
              #6

              I Find solution in this link Excel serial date to Day, Month, Year and vise versa[^]

              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