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 ()).