The getSheet (I) of phpexcel can only read one page. how can I obtain the number of pages in an excel file?

Source: Internet
Author: User
The getSheet (I) of phpexcel can only read one page. how can I obtain the number of pages in an excel file? The getSheet of phpexcel can only read one page. how can I obtain the number of pages in an excel file ?, Count ?, // Obtain the number of worksheets $ sheetCount = $ PHPExcel-& gt; getSheetCount (); PHPc phpexcel's getSheet (I) can only read one page. how can I obtain the number of pages in an excel worksheet?
The getSheet of phpexcel can only read one page. how can I obtain the number of pages in an excel worksheet?

------ Solution --------------------
Count?
------ Solution --------------------
// Obtain the number of worksheets
$ SheetCount = $ PHPExcel-> getSheetCount ();
PHP code
  CanRead ($ filePath) {$ PHPReader = new PHPExcel_Reader_Excel5 (); if (! $ PHPReader-> canRead ($ filePath) {echo 'no Excel file found! '; Return;} // functions that obtain all worksheet arrays without reading the entire Excel file. This function is useful, $ sheetNames = $ PHPReader-> listWorksheetNames ($ filePath); // read the Excel file $ PHPExcel = $ PHPReader-> load ($ filePath ); // Obtain the number of worksheets $ sheetCount = $ PHPExcel-> getSheetCount (); // select the first worksheet $ currentSheet = $ PHPExcel-> getSheet (0 ); // obtain the total number of columns $ allColumn = $ currentSheet-> getHighestColumn (); // obtain the total number of rows $ allRow = $ currentSheet-> getHighestRow (); // read data cyclically. the default encoding is utf8, which is converted to gbk output for ($ currentRow = 1; $ currentRow <= $ allRow; $ currentRow ++) {for ($ currentColumn = 'a'; $ currentColumn <= $ allColumn; $ currentColumn ++) {$ address = $ currentColumn. $ currentRow; echo iconv ('utf-8', 'gbk', $ currentSheet-> getCell ($ address)-> getValue ()). "\ t";} echo"
";}?>

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.