Updating some data to the same xlsx file using phpexcel.

Topics: Developer Forum, User Forum
Sep 24, 2013 at 10:00 AM
Edited Sep 24, 2013 at 10:05 AM
Hi All,
       I'm facing some issue while updating the same xlsx file with some new data's. The file is created with out any problem, While opening that file I can't able to see all data's which was previously available and after updating its not there. Here is my code
            $objPHPExcelres = PHPExcel_IOFactory::load("test.xlsx");
            $maxCellres = $objPHPExcelres->getActiveSheet()->getHighestRowAndColumn();
            $coln = $maxCellres["column"];
            $coln++;
            $objPHPExcelres->setActiveSheetIndex(0);
            $objPHPExcelres->getActiveSheet()->getCell($coln."1")->setValue("Comments");
            for($ii=0;$ii<count($sheetData);$ii++){
                    $objPHPExcelres->getActiveSheet()->getCell($coln.($ii+2))->setValue("test data");
            }
            $objWriterRes = PHPExcel_IOFactory::createWriter($objPHPExcelres, 'Excel2007');
            $objWriterRes->save("test.xlsx");
I'm trying to add an column comments with existing row datas. The above code is working fine with xls extension and not working xlsx extension

If anyone have a solution for this, please update me...