1024programmer PHP phpexcel’s getSheet(i) can only read one page. How to get how many pages an excel has?

phpexcel’s getSheet(i) can only read one page. How to get how many pages an excel has?

phpexcel’s getSheet(i) can only read one page. How to get how many pages an excel has?
phpexcel’s getSheet can only read one page. How to get how many pages an excel has?

——Solution——————–
count?

——Solution——————–
//Get the number of worksheets
$sheetCount = $PHPExcel->getSheetCount();

PHP code

canRead($filePath))
{
$PHPReader = new PHPExcel_Reader_Excel5();
if(!$PHPReader->canRead($filePath))
{
echo 'Excel file not found! ';
return;
}
}

//A function to obtain all worksheet arrays without reading the entire Excel file. I feel that this function is very useful. It took me a long time to find it.
$sheetNames = $PHPReader->listWorksheetNames($filePath);

//Read Excel file
$PHPExcel = $PHPReader->load($filePath);

//Get the number of worksheets
$sheetCount = $PHPExcel->getSheetCount();

//Select the first worksheet
$currentSheet = $PHPExcel->getSheet(0);

//Get how many columns there are in total
$allColumn = $currentSheet->getHighestColumn();

//Get how many rows there are in total
$allRow = $currentSheet->getHighestRow();

//Loop to read data, the default encoding is utf8, here converted to gbk output
for($currentRow = 1;$currentRow<=$allRow;$currentRow++)
{
for($currentColumn='A';$currentColumngetCell($address)->getValue() )."\t";
}
echo "
";
}
?>

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/phpexcels-getsheeti-can-only-read-one-page-how-to-get-how-many-pages-an-excel-has/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: 34331943@QQ.com

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索