xxxxxxxxxx
//TRY THIS
if($_FILES['name']['type'] =='application/vnd.ms-excel'){
$FileUpload=$_FILES["name"]["tmp_name"];
if(($getfile = fopen($FileUpload, "r")) !== FALSE) {
while(($Column = fgetcsv($getfile, 10000, ",")) !== FALSE) {
if($rowdata >= 1) {
echo "Column 1 ".$Column[0]." , Column 2 ".$Column[1];
}
}
}
}
xxxxxxxxxx
// https://opensource.box.com/spout/
use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;
$reader = ReaderEntityFactory::createReaderFromFile('/path/to/file.xlsx');
$reader->setShouldPreserveEmptyRows(true);
foreach ($reader->getSheetIterator() as $sheet) {
foreach ($sheet->getRowIterator() as $row) {
$cells = $row->getCells();
foreach ($cells as $cell) {
echo $cell->getValue();
}
}
}