Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 12, 2019 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/4971f40694efcdd1e9f784dac147bc07 to your computer and use it in GitHub Desktop.
Save parzibyte/4971f40694efcdd1e9f784dac147bc07 to your computer and use it in GitHub Desktop.
<?php
# Calcular el máximo valor de la fila como entero, es decir, el
# límite de nuestro ciclo
$numeroMayorDeFila = $hojaDeProductos->getHighestRow(); // Numérico
$letraMayorDeColumna = $hojaDeProductos->getHighestColumn(); // Letra
# Convertir la letra al número de columna correspondiente
$numeroMayorDeColumna = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($letraMayorDeColumna);
// Recorrer filas; comenzar en la fila 2 porque omitimos el encabezado
for ($indiceFila = 2; $indiceFila <= $numeroMayorDeFila; $indiceFila++) {
# Aquí obtener el valor con:
$hojaDeProductos->getCellByColumnAndRow(1, $indiceFila);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment