Skip to content

Instantly share code, notes, and snippets.

@rapliandras
Last active August 26, 2017 13:07
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 rapliandras/5ffd93ad214f6723d1c7c68d355e81ff to your computer and use it in GitHub Desktop.
Save rapliandras/5ffd93ad214f6723d1c7c68d355e81ff to your computer and use it in GitHub Desktop.
$inputFileName = "xxxxxx.xlsx";
try {
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
} catch(Exception $e) {
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}
// Get worksheet dimensions
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
$rowData = $sheet->rangeToArray('A2:A' . $highestRow, NULL, TRUE, FALSE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment