Spreadsheet for PHP Excel reading

Source: Internet
Author: User
Tags php excel
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. The Code is as follows :? Php calls Readerrequire_onceSpreadsheetExcelReaderreader.php; creates Reader $ datanew

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. The Code is as follows :? Php // call Reader require_once 'spreadsheet/Excel/Reader/reader. php'; // create Reader $ data = new

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.

The following code:

 SetOutputEncoding ('gb2312'); // read the Excel file $ data-> read ("c: \ test.xls "); // $ data-> sheets [0] ['numrows '] is the number of rows in Excel for ($ I = 1; $ I <= $ data-> sheets [0] ['numrows ']; $ I ++) {// $ data-> sheets [0] ['numcols'] indicates the number of Excel columns 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.