phpExcel creates unwanted tabs

Topics: Developer Forum
Jun 3, 2011 at 10:23 AM


I need to open an excel file (2007 format) with some tabs, and add new data every month on a different column.

When i save the file, i notice that i end up with duplicate tabs

if i have tabs: tab 1, tab 2, tab 3

i end up with data in those tabs, plus empy tabs called tab 1 1, tab 2 1, tab 3 1.

I commented most of my code out and left just the loading file and writing to file parts and the problem still remains, this is my code (with the commented parts removed)


			$objPHPExcel = new PHPExcel();

			// Set value binder
			PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
			//load file
			$cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_to_phpTemp; 
			$cacheSettings = array( ' memoryCacheSize ' => '1024MB'); 
			PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings); 
			$objReader = new PHPExcel_Reader_Excel2007();

			$objPHPExcel = $objReader->load(APPLICATION_PATH . "/data/excel/" . "Test.xlsx");
			$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
			$file_name = 'Test.xlsx';
			$objWriter->save(APPLICATION_PATH . "/data/excel/" . $file_name);




Jun 3, 2011 at 9:11 PM

There is a work item for this issue; but I have still never managed to recreate it myself (even with provided files), which makes it very difficult to debug.

Jun 7, 2011 at 10:01 AM

thanks for your answer.


not sure if it helps, but when i change from excel2007 to excel5, it doesnt create the new tabs.