使用PHPExcel追加到Excel文件
我想用一个表单来添加input到一个excel文件。 我有以下的HTML表单。
<form action="test_003.php" method="post"> First Name: <input type="text" name="firstName"><br /><br /> Last Name: <input type="text" name="lastName"><br /><br /> E-mail: <input type="text" name="email"><br /><br /> <input type="submit"> </form>
和我的PHP是:
<?php /** Include PHPExcel */ require_once 'Classes/PHPExcel.php'; require_once 'Classes/PHPExcel/IOFactory.php'; $objPHPExcel = PHPExcel_IOFactory::load("spread.xlsx"); $objPHPExcel->setActiveSheetIndex(0); $row = $objPHPExcel->getActiveSheet()->getHighestRow()+1; $objPHPExcel->getActiveSheet()->SetCellValue('A'.$row, $_POST['firstName']); $objPHPExcel->getActiveSheet()->SetCellValue('B'.$row, $_POST['lastName'] ); $objPHPExcel->getActiveSheet()->SetCellValue('C'.$row, $_POST['email']); $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel); $objWriter->save('spread.xlsx'); ?>
问题是,似乎没有发生在服务器上的spread.xlsx文件