Announcement

Collapse
No announcement yet.

Anyone have an example of using LIBXL to read cells from .XLSX file?

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

  • Anyone have an example of using LIBXL to read cells from .XLSX file?

    Anyone have an example of using LIBXL to read cells from .XLS or .XLSX file?

    If you use LIBXL do you like it?
    Last edited by David Clarke; 30 Oct 2019, 09:55 PM.

  • #2
    hello David
    about a year ago or so I translated a couple C examples to FreeBasic, but not a reading example, however, you might figure out how to read a cell by looking at the sample and the sheet functions http://www.libxl.com/spreadsheet.html?lang=c
    my translated example can be found here https://www.freebasic.net/forum/viewtopic.php?t=25763

    perhaps something like this, not tested
    Code:
    function PbMain
        dim as BookHandle book = xlCreateBook()
        if book then
            if xlBookLoad(book, "example.xls") then
                dim as SheetHandle sheet = xlBookGetSheet(book, 0)
                if sheet then
                    dim d as double
                    dim s as const zstring ptr = xlSheetReadStr(sheet, 2, 1, 0) 'FB code, sorry
                    if s then
                        print s
                    end if
                    d = xlSheetReadNum(sheet, 3, 1, 0)
                    print d
                end if
            end if
            xlBookRelease(book)
        end if
    end function
    as the salmon fish is compelled to go back to it's birthplace to spawn, so comes a day when man is compelled to go back to it's source.. GOD

    Comment


    • #3
      Do a search in the forum on LibXl and you will find some goodies.
      Fim Wästberg

      Comment


      • #4
        Hi Fim!

        I have seen lots of examples of writing to excel but none of read from when file is xlsx.

        Comment


        • #5
          ADO also allows you to read Excel files.

          Comment


          • #6
            Hi Knuth, LibEx looks amazing. You don't need to have excel installed to use it! Totally stand alone.

            Comment


            • #7
              It's always something simple - book = xlCreateXMLBook()

              Comment


              • #8
                Originally posted by David Clarke View Post
                Hi Knuth, LibEx looks amazing. You don't need to have excel installed to use it! Totally stand alone.
                So does ADO. But if LibEx fits your needs - all power to you.

                Comment


                • #9
                  The nice thing about LIBXL is you don't need to have excel installed on the computer.

                  Comment


                  • #10
                    Again: so does ADO. No need for a local installation of Excel.

                    Comment


                    • #11
                      Didn't know that Knuth!

                      Comment

                      Working...
                      X