2

Cordial Saludo,

Les comento, necesito cargar un excel de aproximado 350.000 registros, y aproximado 60 campos, esto lo hago con php y no me los carga, ya que son bastante, me carga como 30.000, he configurado el php.ini a los recursos del servidor, pero no, es lo máximo que he podido llegar,

Utilizo PHPExcel:

$target_path = 'subidas/';
$target_path = $target_path . basename( $_FILES['pacientes_file']['name']); 
move_uploaded_file($_FILES['pacientes_file']['tmp_name'], $target_path);

$inputFileType = PHPExcel_IOFactory::identify($target_path);
$ob

jReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($target_path);
$sheet = $objPHPExcel->getSheet(0); 
$highestRow = $sheet->getHighestRow();  
$highestColumn = $sheet->getHighestColumn();
$usuario = $_SESSION['CodUser'];
$usuario = trim($usuario);

for ($row = 2; $row <= $highestRow; $row++){ 
  $cod_os = $sheet->getCell("A".$row)->getValue();
  $sucursal = $sheet->getCell("B".$row)->getValue();
  $nombre_os = $sheet->getCell("C".$row)->getValue();
  $nit_os = $sheet->getCell("D".$row)->getValue();
  $suc_prop_pac = $sheet->getCell("E".$row)->getValue();
  $cod_pac = $sheet->getCell("F".$row)->getValue();
  $nombre_pac = $sheet->getCell("G".$row)->getValue();
  $estado_pac = $sheet->getCell("H".$row)->getValue();
  $descripcion_motivo_baja = $sheet->getCell("I".$row)->getValue();
  $Descripcion_motivo_inhibicion = $sheet->getCell("J".$row)->getValue();

  $procedure_params = array(
    array(&$cod_os, SQLSRV_PARAM_IN),
    array(&$sucursal, SQLSRV_PARAM_IN), 
    array(&$nombre_os, SQLSRV_PARAM_IN),
    array(&$nit_os, SQLSRV_PARAM_IN),
    array(&$suc_prop_pac, SQLSRV_PARAM_IN),
    array(&$cod_pac, SQLSRV_PARAM_IN),
    array(&$nombre_pac, SQLSRV_PARAM_IN),
    array(&$estado_pac, SQLSRV_PARAM_IN),
    array(&$descripcion_motivo_baja,SQLSRV_PARAM_IN),
  );

  $sql = "EXEC SP_INSERT_PACIENTE_INHIBIDOS @cod_os = ?, @sucursal = ?, 
                  @nombre_os = ?,@nit_os = ?, @suc_prop_pac= ?,
                  @cod_pac= ?, @nombre_pac= ?, 
                  @estado_pac = ?, @descripciona_motivo_baja= ?";

  $stmt = sqlsrv_prepare($conn, $sql, $procedure_params);

  if(sqlsrv_execute($stmt)){
    $result = 1;
  }else{
    $result = 0;
  }
}

El código funciona bien, pero no logra cargar todo, hay alguna forma de hacer que no tenga que leerlo línea a línea.

Gracias

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.