Open Xenofexs opened 6 years ago
Hi. I use this code for transform xls to csv.
require_once 'Classes/PHPExcel/IOFactory.php'; $inputFileType = 'Excel5'; $inputFileName = 'YOUR_EXCEL_FILE_PATH'; $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcelReader = $objReader->load($inputFileName); $loadedSheetNames = $objPHPExcelReader->getSheetNames(); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcelReader, 'CSV'); foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) { $objWriter->setSheetIndex($sheetIndex); $objWriter->save($loadedSheetName.'.csv'); }
require_once 'Classes/PHPExcel/IOFactory.php';
$inputFileType = 'Excel5'; $inputFileName = 'YOUR_EXCEL_FILE_PATH';
$objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcelReader = $objReader->load($inputFileName);
$loadedSheetNames = $objPHPExcelReader->getSheetNames();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcelReader, 'CSV');
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) { $objWriter->setSheetIndex($sheetIndex); $objWriter->save($loadedSheetName.'.csv'); }
But the percent is not converted. Ex : In the xls, C1 = 0,0226115615112098% After the convertion, in the CSV, C1 = ?0.2f%
I don't find how specify the good format in this case.
Thank you in advence :)
Hi. I use this code for transform xls to csv.
But the percent is not converted. Ex : In the xls, C1 = 0,0226115615112098% After the convertion, in the CSV, C1 = ?0.2f%
I don't find how specify the good format in this case.
Thank you in advence :)