Read Excel php code
/* Report all errors failed t E_NOTICE */error_reporting (E_ALL ^ E_NOTICE); $ filename = $ _ GET ['filename']; $ xlsPath = $ filename; // specify the exls path to be read // $ type = 'excel2007 '; // Set the Excel type to be parsed (2003 or below) or Excel2007 $ type = 'excel5'; // introduces the excel class include 'load. php '; include' Classes/PHPExcel. php'; include 'classes/PHPExcel/IOFactory. php '; $ xlsReader = PHPExcel_IOFactory: createReader ($ type); $ xlsReader-> setReadDataOnly (true); $ xlsReader-> setLoadSheetsOnly (true ); $ Sheets = $ xlsReader-> load ($ xlsPath); // start to read $ Sheet = $ Sheets-> getSheet (0)-> toArray (); // read the first worksheet (note that the number starts from 0). If you want to read multiple worksheets, you can create a loop of 0, 1, 2, 3 .... // Obtain a two-dimensional array. each small array is the echo ''; echo 'Count the total number of orders 'in each row containing this row in an excel table '; $ data = array (); for ($ I = 2; $ i0) {$ info [$ val ['name'] =++ $ sum ;} else {$ info [$ val ['name'] = -- $ sum;} foreach ($ info as $ key => $ val) {echo "". $ key. "". $ val. "";}