function convertXLStoCSV($infile, $outfile) // the function that converts the file { $fileType = PHPExcel_IOFactory::identify($infile); $objReader = PHPExcel_IOFactory::createReader($fileType); $objReader->setReadDataOnly(true); $objPHPExcel = $objReader->load($infile); $writer = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV'); $writer->setDelimiter(","); $writer->setEnclosure(""); foreach ($objPHPExcel->getWorksheetIterator() as $workSheetIndex => $worksheet) { $objPHPExcel->setActiveSheetIndex($workSheetIndex); $writer->setSheetIndex($workSheetIndex); $writer->save('converted/' . $outfile ."_" . $worksheet->getTitle() . ".csv"); echo $outfile; echo $infile; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)