php xls/xlsx parser/writer

PHP - Normal Microsoft Windows xls / xsx parsing (C module)


    Good day! It was necessary to load pages with data from xls / xlsx files on the fly and on the fly. After Google’s long rustle, there were libraries (fork xls2csv and xslx2csv) xls & xlsxarray, for the Zend engine as extensions. These libraries immediately issue php information in an array. In principle, what was needed. Example 1 shows how this works. Also in the set there is how to generate xlsx files from php. Those. just plug in the modules and work with xls and xslx.

    But the most important thing is that the parsing is done by the library itself written in c, which is just so much saves RAM.

Developers who donate can add functionality as they please. It is distributed free of charge, and only donate is taken for modules. You can also write to developers if php extensions are required in the form of zend modules and for a modest donate they will write a module of any complexity. For example, they have a zfs module (in which there is almost all the functionality of managing ZFS without using exec, that is, it works directly with the file system. Of course, you set the access rights for this library yourself), which we will post later. Information on donate can be found at the end of this article.

    We needed to run the modules on FreeBSD and Linux (for different projects). However, no one bothers you to run on Windows. Download the archive with the source code xls parser, and if necessary, the archive with the source code xlswriter. Unpack and go to the source directory. we write the following:

phpize
./configure
make
make install
make clean


On this we get the files so. Go to php.ini and connect as usual by specifying the path to the files or simply the names of the extensions if you first put the files next to the php extensions.

    If you need ready-made compiled modules or extend the functionality, then you can email them at sales@kcs.kz paying a modest donate and ask them to compile for what you need OS. They will be happy to donate and in the amount of $ 3. We also needed compiled modules for CentOS, we did not regret for example $ 100. And we sent the entire set of libraries. With words of gratitude for support.


Functions that are in the library:

On this we get the files so. Go to php.ini and connect as usual by specifying the path to the files or simply the names of the extensions if you first put the files next to the php extensions.

    If you need ready-made compiled modules or extend the functionality, then you can email them at sales@kcs.kz paying a modest donate and ask them to compile for what you need OS. They will be happy to donate and in the amount of $ 3. We also needed compiled modules for CentOS, we did not regret for example $ 100. And we sent the entire set of libraries. With words of gratitude for support.


Functions that are in the library:

XSLX:

xlsx2array ($ filename [, $ sheetname]);
    returns an array of objects, where object is a row
    or false on error
    xlsx_get_sheets ($ filename);
    returns an array of sheetnames
    or false on error


XSL:

xls2array ($ filename [, $ sheetname]);
        returns an array of objects, where object is a row
        or false on error
xls_get_sheets ($ filename);
        returns an array of sheetnames
        or false on error


XSLXWRITER:

$ file_path - full path file
$ data - data of the form:

      [
              [
                     "col1",
                     "col2"
              ],
              [
                     "col1",
                     "col2"
              ]
      ]


EXAMPLE 1:

array (20) {

 [0] =>

  array (8) {

    [0] =>

    string (24) "Name"

    [1] =>

    string (16) "Description"

    [2] =>

    string (27) "Founding Date"

    [3] =>

    string (42) "Last Release Date"

    [4] =>

    string (25) "Full Control"

    [5] =>

    string (23) "Full right"

    [6] =>

    string (14) "Active"

    [7] =>

    Null

  }

  [1] =>

  array (8) {

    [0] =>

    string (3) "8on"

    [1] =>

    string (92) "Authorization by file-key (details in documents)"

    [2] =>

    int (42545)

    [3] =>

    int (43194)

    [4] =>

    string (1) "+"

    [5] =>

    string (1) "+"

    [6] =>

    string (1) "+"

    [7] =>

    Null

  }

  [2] =>

  array (8) {

    [0] =>

    string (12) "DOCS manager"

    [1] =>

    string (80) "Document Accounting Information System"

    [2] =>

    int (43203)

    [3] =>

    int (43205)

    [4] =>

    string (1) "+"

    [5] =>

    string (1) "+"

    [6] =>

    string (1) "-"

    [7] =>

    Null

  }

  [3] =>

  array (8) {

    [0] =>

    string (5) "Eveny"

    [1] =>

    string (106) "Poster site (old name: YouVis) (more in documents)"

    [2] =>

    int (40831)

    [3] =>

    string (1) "-"

    [4] =>

    string (1) "+"

    [5] =>

    string (1) "-"

    [6] => string (1) "-" [7] => NULL}


[6] =>

    string (1) "-"

    [7] =>

    Null

  }


Summarizing:


    we want to note that the main goal of the team is to expand the functionality of php and make these extensions easy to use. Support the team and we will see the modules for php: zfs, docx_doc_writer_php, php_web_server_forks, network settings (FreeBSD / Debian / Ubuntu / CentIoOS), ipfw_php, netgraph_php and so on.



Xlswriter

XLSPARSER


DONATE:


                                                    

    MASTER CARD:

                        : 5169 4971 6605 6378

    BANK:

                        : KZ86826A1KZTD2012009

                        : 170 340 020 993

                        : SABRKZKA