PhpExcelReader reads excel files-PHP source code

Source: Internet
Author: User
Ec (2); 1. & nbsp; Overview php tutorial-excelreader & nbsp; Is a read excelxsl & nbsp; a php & nbsp; Class in the file content. Its download URL: & nbsp; sourceforge. netprojectsphpexcelreader this blog: phpexcelreader. z script ec (2); script

I. Overview

Php tutorial-excelreader is a php class that reads the content of an excel xsl file.

Its download URL: http://sourceforge.net/projects/phpexcelreader/

This blog: phpexcelreader.zip

Excel files for testing: Test. xls

File Name: phpexcelreader.zip

Contains two required files: oleread. inc and reader. php. Other files are an application example and a self-report file.

Ii. File Usage

First, include the reader file: require_once "reader. php ";

Create an instance: $ xl_reader = new spreadsheet_excel_reader ();

Set the encoding information: $ xl_reader-> setoutputencoding ('utf-8'); // if this parameter is not set, it may be garbled with the encoding displayed on the webpage.

Read excel File Information: $ xl_reader-> read ("filename.xls ");

It stores all identifiable data in the exported excel file in one object. Data is stored in two arrays. Currently, no methods/functions are provided to access the data. You can use the array name as follows.

The sheets array contains a large amount of data read into the object. It stores all identifiable data in the exported excel file in a two-dimensional array $ xl_reader-> sheets [x] [y]. X is the sequence number of the table in the document, and y is one of the following parameters:

① Numrows -- int -- number of rows in the table

For example: $ rows = $ xl_reader-> sheets [0] ['numrows ']

② Numcols -- int -- number of columns in the table

Example: $ cols = $ xl_reader-> sheets [0] ['numcols']

③ Cells -- array -- actual table content. Is a 2-dimensional array in the format of [row] [column]

For example: $ cell_2_4 = $ xl_reader-> sheets [0] ['cells '] [2] [4] // Row 2, data in column 4

④ Cellsinfo -- array -- information of different data types in the table. Each table contains the original data and type of the table. This array contains two parts: raw -- original table data; type -- data type.

Note: Only non-text data information is displayed.

Example: $ cell_info = $ xl_reader [0] ['cellsinfo'] [2] [4]

$ Cell_info ['Raw'] is the raw data from the cell

$ Cell_info ['type'] is the data type

$ Xl_reader-> sheets

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.