Ola
Copiei o codigo do video :
no OnScriptInit :
require_once('../../../..'.$this->Ini->path_prod.'/third/phpexcel/PHPExcel.php');
no OnValidate:
$objReader = new PHPExcel_Reader_Excel5();
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load("../../../tmp/".$this->documento_ul_name);
$worksheetData = $objReader->listWorksheetInfo("../../../tmp/".$this->documento_ul_name);
$totalRows = $worksheetData[0]['totalRows'];
$totalColumns = $worksheetData[0]['totalColumns'];
$lastColumn = $objPHPExcel->getActiveSheet()->getHighestColumn();
$sheet = $objPHPExcel->getSheet(0);
$columnNames = "";
$rowDate = "";
for($colum=0;$colum<$totalColumns;$colum++)
{
if($colum==$totalColumns-1)
{
$columnNames.= utf8_decode($objPHPExcel->getActiveSheet()->getCellByColumnAndRow($colum, 1)->getValue());
}
else
{
$columnNames.= utf8_decode($objPHPExcel->getActiveSheet()->getCellByColumnAndRow($colum, 1)->getValue()).",";
}
}
for($row =2; $row <= $totalRows; $row++)
{
for($colum=0;$colum < $totalColumns;$colum++)
{
if($colum == $totalColumns-1)
{
$rowDate .= "'".utf8_decode($objPHPExcel->getActiveSheet()->getCellByColumnAndRow($colum, $row)->getValue())."'";
}
else
{
$rowDate .= "'".utf8_decode($objPHPExcel->getActiveSheet()->getCellByColumnAndRow($colum, $row)->getValue())."',";
}
}
// echo "insert into planilha1 (".$columnNames.") values (".$rowDate.")";
// print_r($rowDate);
}