load($_FILES['file']['tmp_name']);
//$lastRow = $spreadsheet->getHighestDataRow();
//echo $lastRow;
$worksheet = $spreadsheet->getActiveSheet();
// Get the highest row and column numbers referenced in the worksheet
$highestRow = $worksheet->getHighestRow(); // e.g. 10
$highestColumn = $worksheet->getHighestColumn(); // e.g 'F'//$highestColumnIndex = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($highestColumn); // e.g. 5
echo 'hrow='.$highestRow.' hcol'.$highestColumn ;
$col='K';
$row=6;
echo '
' .
$worksheet->getCell($col . $row)
->getValue() .
' | ' . PHP_EOL;
$cellValue = $spreadsheet->getActiveSheet()->getCellByColumnAndRow(1, 4)->getCalculatedValue();
echo $cellValue;
$cellValue = $spreadsheet->getActiveSheet()->getCellByColumnAndRow(6, 5)->getValue();
echo $cellValue;
$cellValue = $spreadsheet->getActiveSheet()->getCell('A11')->getValue();
echo 'my cell value='.$cellValue.'===';
$sheetData = $spreadsheet->getActiveSheet()->toArray();
if (!empty($sheetData)) {
for ($i=1; $iquery($sql);
while($rowa = $resulta->fetch_assoc())
{
$cmpn=$rowa["branch_id"];
}
$sql="insert into bio_device_master (active_status,company_id,device_name,location_name,device_sn,branch_id,device_type )
values ( 1,119,'".$dn."','".$dloc."','".$dsn."',".$cmpn.",'".$m."')";
if (mysqli_query($conn, $sql)) {
// echo "New record created successfully";
//} else {
// echo "Error: " . $sql . "
" . mysqli_error($conn);
}
// $db->query("INSERT INTO USERS(name, email, company) VALUES('$name', '$email', '$company')");
}
}
echo "Records inserted successfully.";
} else {
echo "Upload only CSV or Excel file.";
}
}
?>