Having problem converting one sheet of a spreadsheet to csv

Aug 14, 2014 at 5:27 PM
Hello,

I am trying to convert individual sheets of an xlsx document to csv documents but am having problems with one of the pages.
<?
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);

require_once('libs/Classes/PHPExcel.php');
file_put_contents("input.xlsx", fopen("http://docs....", 'r'));
 
convertXLStoCSV('Weapons','input.xlsx','./csvOut/weapons.csv');
convertXLStoCSV('Armor','input.xlsx','./csvOut/armor.csv');
convertXLStoCSV('Shields','input.xlsx','./csvOut/sheilds.csv');
 
function convertXLStoCSV($type,$infile,$outfile)
{
    $fileType = PHPExcel_IOFactory::identify($infile);
    $objReader = PHPExcel_IOFactory::createReader($fileType);
 
    $objReader->setReadDataOnly(true);  
    $objReader->setLoadSheetsOnly($type);
    $objPHPExcel = $objReader->load($infile);    
 
    $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
    $objWriter->setDelimiter("|");
    $objWriter->save($outfile);
}
 
?>
In my code above you can see 3 pages are being converted however the "Armor" page does not and instead the index page is being converted.

Has anyone any idea how I can get around this?