Boa tarde!
Pessoal to com o seguinte erro ao importar uma planilha excel utilizando a biblioteca PHPEXCEL
Erro:
Fatal error: Class ‘PHPExcel_Reader_Excel5’ not found in
Chamo a biblioteca no onaplicationInit
require_once(’…/…/…/…’.$this->Ini->path_prod.’/third/phpexcel/PHPExcel.php’);
Codigo do onvalidatesucess
$reader = new PHPExcel_Reader_Excel5();
$reader->setReadDataOnly(true);
//carrega o arquivo
$objExcel = $reader->load("…/…/…/tmp/".$this->xls_input_url_name);
$worksheetData = $reader->listWorksheetInfo("…/…/…/tmp/".$this->xls_input_url_name);
$totalRows = $worksheetData[0][‘totalRows’];
$totalColumns = $worksheetData[0][‘totalColumns’];
$lastColumn = $objExcel->getActiveSheet()->getHighestColumn();
$sheet = $objExcel->getSheet(0);
$columnNames = “”;
$rowDate = “”;
for ($column = 0; $column < $totalColumns; $column++) {
if ($column == $totalColumns - 1) {
$columnNames .= utf8_decode($objExcel->getActiveSheet()->getCellByColumnAndRow($column, 1)->getValue());
} else {
$columnNames .= utf8_decode($objExcel->getActiveSheet()->getCellByColumnAndRow($column, 1)->getValue().",");
}
}
for ($row = 2; $row <= $totalRows; $row++) {
for ($column = 0; $column < $totalColumns; $column++) {
if ($columns == $totalColumns - 1) {
$rowDate .= "'".utf8_decode($objExcel->getActiveSheet()->getCellByColumnAndRow($column, 1)->getValue())."'";
} else {
$rowDate .= "'".utf8_decode($objExcel->getActiveSheet()->getCellByColumnAndRow($column, 1)->getValue()).",";
}
}
echo “INSERT INTO gen_ss (”.$columnNames.") VALUES (".$rowDate.") “;
echo “>br>”;
$rowDate=”";
}