Answer the question
In order to leave comments, you need to log in
How to open excel file in browser?
Hello,
There is a card.xlsx file . I open it with PHPExcel and add data to certain cells.
/** PHPExcel */
include ('classes/PHPExcel.php');
/** PHPExcel_Writer_Excel2007 */
include ('classes/PHPExcel/Writer/Excel2007.php');
include ('classes/PHPExcel/IOFactory.php');
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$objPHPExcel = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objPHPExcel->load("card.xlsx");
$objPHPExcel->setActiveSheetIndex(0);
// Add some data
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->SetCellValue('A1', 'world!');
$objPHPExcel->getActiveSheet()->SetCellValue('A2', 'Hello');
$objPHPExcel->getActiveSheet()->SetCellValue('D1', 'world!');
// Rename sheet
$objPHPExcel->getActiveSheet()->setTitle('Simple');
// Save Excel 2007 file
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save(time().".xlsx");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question