Spreadsheet_excel_reader for PHP Excel reading

Source: Internet
Author: User

Similar to spreadsheet_excel_writer, spreadsheet_excel_reader is a tool used to read Excel content.
Excel data can be easily imported to data or used for other purposes.

As follows:Code:

 <? PHP // Call Reader  Require_once ' Spreadsheet/EXCEL/Reader/reader. php '; // Create Reader $ DATA = new spreadsheet_excel_reader (); // Sets the text output encoding. $ Data-> setoutputencoding (' Gb2312 '); // Read the Excel file $ Data-> Read ("C: \ test.xls "); // $ Data-> sheets [0] ['numrows '] indicates the number of rows in Excel  For ($ I = 1; $ I <= $ data-> sheets [0] [' Numrows ']; $ I ++ ){ // $ Data-> sheets [0] ['numcols'] indicates the number of columns in Excel.  For ($ J = 1; $ j <= $ data-> sheets [0] [' Numcols ']; $ J ++ ){ // Display the content of each cell  Echo $ Data-> sheets [0] [' Cells '] [$ I] [$ J];} ?> 

In addition, due to the special nature of the date type, errors may occur during the value. You can set the Excel cell type to text,
Read a date in text format. If you need a date character, you can use PHP to process it (strtotime () and date ()).

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.