Announcement

Collapse
No announcement yet.

How can I read data from Excel file with PB

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I read data from Excel file with PB

    I am trying to pull data from Excel datafile and cannot find out where to start.
    Magnus Soffaniasson
    http://vdsl.is

  • #2
    Can you save the Excel file as .CSV and extract the data from there?
    Rgds, Dave

    Comment


    • #3
      Not sure about CC, but in PBWin, a good place to start is looking in ...\samples\Objects\Excel

      Is that also in the current CC installation?

      Comment


      • #4
        ...\samples\Objects\Excel
        That directory also exists for PBCC6. For PBCC5 it is ..\samples\COM\Excel

        Except for PBCC having console commands, and PBWin having GUI commands, they are (almost (just in case)) completely the same in other respects.

        With COM (and Excel on the run time PC) you can avoid .CSV. Work directly with a spreedsheet from PB.

        With .CSV you work with/create data with PB, then import to Excel later. (Excel can output to .CSV too!)

        Combos of above are also possible. Like use COM to get data to work with from .XLS the use in a PB prog.

        ((it must be possible, but I always found working with MS file formats a PIA. Let MS prog of correct version (Word, Excel, Access) do it.))

        Cheers,
        Dale

        Comment


        • #5
          Hav a look at http://www.libxl.com/
          /Fim
          Fim Wästberg

          Comment


          • #6
            Originally posted by Dale Yarker View Post
            That directory also exists for PBCC6. For PBCC5 it is ..\samples\COM\Excel

            Except for PBCC having console commands, and PBWin having GUI commands, they are (almost (just in case)) completely the same in other respects.

            With COM (and Excel on the run time PC) you can avoid .CSV. Work directly with a spreedsheet from PB.

            With .CSV you work with/create data with PB, then import to Excel later. (Excel can output to .CSV too!)

            Combos of above are also possible. Like use COM to get data to work with from .XLS the use in a PB prog.

            ((it must be possible, but I always found working with MS file formats a PIA. Let MS prog of correct version (Word, Excel, Access) do it.))

            Cheers,
            Yeah, AND you have to have a SUPPORTED version of Excel installed plus the VBA addon installed as well:

            ' * Tested with Excel v9.00 (Office 2000) and v12.0 (Office 2007) and VBA
            ' installed *

            [...]

            ' Could EXCEL be opened? If not, terminate this app
            IF ISFALSE ISOBJECT(oExcelApp) OR ERR THEN
            PRINT "Excel could not be opened."
            PRINT "Please check that Excel and VBA are installed."
            PRINT
            PRINT "Press any key to exit..."
            WAITKEY$
            EXIT FUNCTION
            END IF

            Comment


            • #7
              Originally posted by Robert Wolfe View Post

              Yeah, AND you have to have a SUPPORTED version of Excel installed plus the VBA addon installed as well:
              it has worked for me with every version of Excel/Office from 2000 to 2016.

              VBA is not an addon, it's part of the standard Excel installation and has been since at least Office 95 (IIRC).

              Just run the PB COM browser and generate the appropriate .inc file for your installation fo Excel.exe



              Comment


              • #8
                You can certainly "roll your own" any number of ways but I will also vouch for libxl.com. Makes quick work of reading/writing XLS files.

                Comment

                Working...
                X