I am new to php as well to phpExcel
. I just want to save post data to a existing excel sheet every time to a new row.
As i searched on Stackoverflow.com i got the reference of library phpExcel
.
I write down the following code from taking some samples.
<?php
/** Include PHPExcel */
require_once 'Classes/PHPExcel.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->SetCellValue('A'.$row, $_POST['name']);
$objPHPExcel->getActiveSheet()->SetCellValue('B'.$row, $_POST['email']);
$objPHPExcel->getActiveSheet()->SetCellValue('C'.$row, $_POST['phone']);
$objPHPExcel->getActiveSheet()->SetCellValue('D'.$row, $_POST['city']);
$objPHPExcel->getActiveSheet()->SetCellValue('E'.$row, $_POST['kid1']);
$objPHPExcel->getActiveSheet()->SetCellValue('F'.$row, $_POST['kid2']);
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save('myfile.xlsx');
?>
but the problem i am facing that i don't have idea how to append new row to excel sheet so every time posted data saved to new row.
I know my this code is only saving file to disk everytime with a single row, but i need to append new row to last excel sheet.