0
嘗試循環到每個工作表並清理C列中的任何工作表。我收到消息的安全性索引超出範圍,請幫助。我已添加我的代碼是否有一個步驟缺少。循環瀏覽工作表並清理phpexcel中每個工作表中的列
<?php
include'../Classes/PHPExcel.php';
include'../Classes/PHPExcel/IOFactory.php';
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("../upload/combined.xlsx");
ini_set('max_execution_time', 2000);
$i = 0;
while ($objPHPExcel->setActiveSheetIndex($i)){
$objWorksheet = $objPHPExcel->getActiveSheet();
$highestRow = $objWorksheet->getHighestRow();
for($cl=0;$cl<$highestRow+1;$cl++){
$clean=$objPHPExcel->getActiveSheet()->getCell('C'.$cl)->getValue();
$cleandone=str_replace(',',"",$clean);
$objWorksheet->setCellValue('C'.$cl,$cleandone);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('../upload/combined.xlsx');
$i++;
}
}
echo "Done";
?>